سؤال

I have an issue that I'm finding difficult to troubleshoot. I've created an app where I have the menu setup as such:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.brainbox.dropnotelitealpha.app.MainActivity" >

  <item
    android:id="@+id/action_settings"
    android:title="@string/action_settings"
    android:orderInCategory="1"
    android:showAsAction="never"/>

    <item android:id="@+id/action_logout"
        android:title="Logout"
        android:orderInCategory="2"
        android:showAsAction="never" />
</menu>

I can access the items by pressing on the overflow icon in the ActionBar. The problem I have is that when I test the app on a Samsung S4, the overflow icon does not display. If I use an emulator, or any other device, the overflow displays as desired.

Does anyone have any ideas what may prevent the menu from displaying? Oh, it's only when menu items are set to android:showAsAction="never".

TIA

هل كانت مفيدة؟

المحلول

Change your code to this and see if it's fixed:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.brainbox.dropnotelitealpha.app.MainActivity" >

  <item
    android:id="@+id/action_settings"
    android:title="@string/action_settings"
    android:orderInCategory="1"
    android:showAsAction="ifRoom"/>

    <item android:id="@+id/action_logout"
        android:title="Logout"
        android:orderInCategory="2"
        android:showAsAction="ifRoom" />
</menu>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top