Skip to content Skip to sidebar Skip to footer

Android - How To Add A Default Checked Checkbox To Navigation Drawer

I want to add a check box to Navigation Drawer, and I want one of them to be default checked I'm using this: app:actionViewClass='android.widget.Switch' as suggested in this answer

Solution 1:

You can do this:

MenuItemitem= navigation.getMenu().findItem(R.id.checkboxX-axis);
CompoundButtoncompoundButton= (CompoundButton) item.getActionView();
compoundButton.setChecked(true);

replace navigation with the NavigationView's name.

Post a Comment for "Android - How To Add A Default Checked Checkbox To Navigation Drawer"