Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to apply setOnClickListener in the menu layout? #78

Open
leonlee0116 opened this issue Nov 6, 2020 · 2 comments
Open

How to apply setOnClickListener in the menu layout? #78

leonlee0116 opened this issue Nov 6, 2020 · 2 comments

Comments

@leonlee0116
Copy link

leonlee0116 commented Nov 6, 2020

In activity onCreate

View view = LayoutInflater.from(this).inflate(R.layout.content_setting, null);
slidingRootNav = new SlidingRootNavBuilder(this)
            .withMenuOpened(true)
            .withContentClickableWhenMenuOpened(true)
            .withSavedState(savedInstanceState)
            .withMenuView(view)
            .inject();

And in my content_setting.xml i have a button, i need to apply action on it so I put

LinearLayout btn = slidingRootNav.getLayout().findViewById(R.id.btnClose);
btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(slidingRootNav.isMenuOpened()){
                slidingRootNav.closeMenu();
            } else {
                slidingRootNav.openMenu();
            }
        }
    });

But the click is not responding, no return error to me also.
Is there any correct way to do it?

@Jalalnx
Copy link

Jalalnx commented Nov 6, 2020 via email

@Jalalnx
Copy link

Jalalnx commented Feb 22, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants