In the below menu.xml, I am trying to display the menu_exit
in the overflow menu icon, so as shown below I set its showAsAction="never"
, but when I run the app, the overflow menu does not show up.
My questions are:
- How to place the last item in the menu.xml
menu_exit
in the overflow menu? - the 3rd item in the menu.xml, when it is disabled, shows up in the
settings menu
(the lower left button on the device), and what I want is, when it is disabled it should not appear any where, only on theActionBar
when it is enabled.
menu.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_refresh"
android:orderInCategory="1"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_scan"
android:checkable="true"
android:orderInCategory="2"
android:title="@string/menu_scan"
android:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/menu_stop"
android:title="@string/menu_stop"
android:orderInCategory="3"
android:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/menu_exit"
android:title="@string/menu_stop"
android:orderInCategory="4"
android:showAsAction="never"/>
</menu>