Reputation: 51
in my app I can see the actionbar, but I can't see the setting items, because it never call onCreateOptionsMenu.
The app if for target sdk 16, it's composed by a tab and each tab is a fragment. On the Fragment class, during the onCreate() I'm calling setHasOptionsMenu(true). The theme is Theme.Holo.Light. If I run the app on the emulator (Android 4.0) and I press the hardware menu item, it calls the method, but it shows me the menu like the Android 2.3 menu, not in the actionbar!!
I don't think the problem is on the sdk version, because the actionbar is visible! Any idea? what I could check to find the error?
Thanks a lot for every help! My best regards Manuela
Upvotes: 3
Views: 6326
Reputation: 106
i got the same issue and solved by this way
manifest.xml
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
remove android:theme="@android:style/Theme.NoTitleBar"
Upvotes: 4
Reputation: 39836
that's the normal behaviour. The system adapts itself to the hardware it's running on.
If the device does not have a hardware button, it shows as a drop-down from the action bar. If the device does have a hardware button, it shows as a rise-up from near the menu button.
edit
If the menu is on the action bar, it's only created once (because the menus stays on the screen, does not go away like on hardware key phones), so there's another callback, I reckon it's onPrepareOptionsMenu or something similar, that one is called before the menu is shows on the screen.
Upvotes: 1