Android Sherlock action bar always shows actions in the dropdown menu

I installed three action elements that add to the ABS via the XML menu as follows:

<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_share_app" android:icon="@drawable/share_ab" android:showAsAction="collapseActionView" android:title="@string/menu_share_app"/> <item android:id="@+id/menu_search" android:icon="@drawable/share_ab" android:showAsAction="always" android:title="@string/menu_search"/> <item android:id="@+id/menu_settings" android:icon="@drawable/share_ab" android:showAsAction="collapseActionView" android:title="@string/menu_settings"/> </menu> 

I want to show search lists and the other two in the drop-down list, I did showasaction as "collapseActionView", but I don't get any drop-down list. Here is a pic example of what you expect. Thank you :) enter image description here

+4
source share
1 answer

I just changed the code and the order.

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

If you have a physical menu button (e.g. Nexus S) on your device, then the dotted line will not be displayed. Even if your AVD emulates a device with a physical menu button, this will happen. When you press the "Menu" button, it will appear.

+3
source

All Articles