How to implement custom dropdown menu on action bar in android

I am trying to implement dropdown menus in the action bar (the number of items can be very much at runtime). for example, a Google map.

how to implement it in android. here like the menu i'm looking for. If I click on the image button R, I want a drop down menu. similarly, if I press L, the left side menu should appear. any idea how to do this ?.

I do not want a moving one at all, I want a dropdown menu.

enter image description here

+4
source share
1 answer

Regarding the structure of the action bar, you have two options for the left side and one for the right side.

Left-hand side:

Enable action bar dropdown action bar

actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 

or

Add a custom View as a navigation item via ActionBar#setCustomView() , a Spinner in your case.

Right side:

Add only one MenuItem to the action bar as a custom action type , a Spinner in your case.

+4
source

All Articles