3
votes

I create an overflow menu using onCreateOptionsMenu, but the menu is positioned almost completely off the screen. I have tried setting android:anyDensity="true" explicitly (as suggested in Action bar menu shows off screen), but that did not solve the problem for me. I also do not want to follow the suggestion of using an old theme (as in ICS - menu item text cut off?).

Screenshot (the right-hand side of the image is the physical screen border; the image was cut off on the left by me):
enter image description here

The XML is

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/menu_about"
          android:title="About"
          android:icon="@android:drawable/ic_menu_info_details" />
    <item android:id="@+id/menu_reset"
          android:title="Reset image"
          android:icon="@android:drawable/ic_menu_revert" />
    <item android:id="@+id/menu_share"
          android:title="Share"
          android:icon="@android:drawable/ic_menu_share"
          android:showAsAction="ifRoom" />
    <item android:id="@+id/menu_facebook_logout"
          android:title="FB logout"
          android:icon="@drawable/fbook"
          showAsAction="ifRoom" />
    <item android:id="@+id/menu_save"
          android:title="Save"
          android:icon="@android:drawable/ic_menu_save"
          android:showAsAction="ifRoom" />
    <item android:id="@+id/menu_exit"
          android:title="Exit"
          android:icon="@android:drawable/ic_menu_close_clear_cancel" />
</menu>

What am I doing wrong?

2
Why are you not 'or'ing the flag ifRoom with withText within the android:showAsAction tag?t0mm13b
If you can create a sample project that demonstrates this issue, I'll take a look at it.CommonsWare
@t0mm13b, adding withText does not solve the problem (though I should have added it, thanks). Also, I refer to 8549755 in my question already; that one does not solve the problem for me, and I couldn't find any other way to re-attract attention to this problem except for reposting.Kasper Peeters

2 Answers

2
votes

It turned out that I still had a

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, 
                     WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 

in my code, to avoid a bug in earlier Android versions (see Title bar apeared again after coming back in my application).

Removing this (it is no longer necessary in ice-cream-sandwich; have not yet tried other versions) made the overflow menu appear correctly.

0
votes

Check this exact solution:

Action bar menu shows off screen

Seems these should be added in manifest:

<supports-screens
        android:anyDensity="false"
        android:largeScreens="true"
        android:normalScreens="true"
        android:xlargeScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />