Hello!

There was a problem with an element in ActionBar marked as ' android:showAsAction="never" ' - this element is created when there is no menu button on the smartphone.

ab_notifications.xml

 <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/item4" android:icon="@android:drawable/ic_menu_view" android:showAsAction="never" android:title="@string/ab_item_overview"> </item> </menu> 

strings.xml

 <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">App</string> <string name="ab_item_notifications">Notifications</string> </resources> 

NotificationActivity.java

 @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.ab_notifications, menu); return true; } 

On the tablet, it looks like this (the tablet does not have a menu button): alt text

On a smartphone, it looks like this (the Overview item appears after pressing the menu button):

alt text

BUT , all this is some kind of garbage, since the Gmail application was again different:

alt text

alt text

How did they make the menu button on the smartphone display nothing, but this element is always displayed in the ActionBar?

1 answer 1

ActionBar on Android <3.0 will always show below. android: showAsAction = "never" means that this menu item will be inside "⋮".

  • @Anatoliy> android: showAsAction = "never" means that this menu item will be inside "⋮". Yes, I understood that, the question is how to make the "⋮" element always visible, as it is done in the Gmail application? - Opalosolo