Яктенс Тид Яктенс Тид - 1 year ago 146
Java Question

Android something like Navigation Drawer with custom filling

I need something like Navigation Drawer (opening with slide
gesture) to place some layout with buttons. Can you suggest me control or
technique which suite my requirements?

Answer Source

I think you don't need something like Navigation Drawer, but the Navigation Drawer it self. You can have a customized header in a Navigation Drawer or add a menuitems with actionLayout to add custom views to menu items.

Here is a good article from GitHub

To add a custom design for menu items;

<menu xmlns:android="http://schemas.android.com/apk/res/android"


You can design menu_action_layout.xml as you wish. To access the views there in you van use;

NavigationView navigationView=(NavigationView)findViewById(idOfNavigationView);
Menu menu=navigationView.getMenu();
//take a Switch for example
SwitchCompat switch=(SwitchCompat)MenuItemCompat.getActionView(menu.findItem(R.id.menuItemId)).findViewById(R.id.actionLayoutViewId);

//work with the view
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download