I want to show DropDown menu on MenuItem click just like this.
Like this
Note that this item was added like:
<item
android:id="@+id/menu_item_action_parameters"
android:title="@string/text_parameters"
android:icon="@drawable/ic_menu_parameter"
app:showAsAction="ifRoom|withText"/>
</item>
And in my code:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.menu_item_action_parameters:
// What to do here?
break;
}
return super.onOptionsItemSelected(item);
}
I have seen this link but I have came to know that ActionBar.setListNavigationCallbacks()
has been deprecated.
Thanks!
Create your menu xml as follow
Then
what about showing popup menu when clicking onthat item ? here is the code :
and here is the medecin_list_menu (my menu)
Last Edit: see this tutorial http://www.androidhive.info/2013/11/android-working-with-action-bar/
try custom popup menu
menu.Xml
call this code on buttonClick