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.
source share