shiburagi / Drawer-Behavior

Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
https://shiburagi.github.io/Drawer-Behavior/
MIT License
593 stars 101 forks source link

How set click method for menu item #6

Closed ali-bagheri closed 5 years ago

ali-bagheri commented 6 years ago

How can set click method for menu item without use android:onClick=""?

shiburagi commented 6 years ago

same link drawer layout from support library, you may implement NavigationView.OnNavigationItemSelectedListener class and override below code,

    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        // Handle navigation view item clicks here.

        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
nikeru8 commented 5 years ago

@Override public boolean onNavigationItemSelected(MenuItem item) { if(item.getItemId()){ //do something } drawer.closeDrawer(GravityCompat.START); return true; }

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.