Options menu not showing in ICS using compatibility library

南楼画角 提交于 2019-12-01 02:12:02

Removing android:targetSdkVersion="14" from the manifest enables the options menu button again.

This is because I had a theme of @android:style/Theme.Black.NoTitleBar specified in my manifest - with the android:targetSdkVersion of 14, the options menu is being inserted in to the action bar menu, as opposed to the options menu button in the button bar at the bottom of the screen and the theme is removing the activity title, and the action bar.

The action bar can be removed, although I'm not sure if this will fix the issue as I'm yet to get it working so that it's compatible across versions 2.2 - 4.

Simply change the android:targetSdkVersion from "14" to "10" (less then 11), and this problem will be solved.

<uses-sdk android:minSdkVersion="3" 
      android:targetSdkVersion="10" />

According to the Android CDD, the cutoff for the new behavior of not showing the option menu is targetSdkVersion > 10. Your options are either to run your app in legacy mode with targetSdkVersion <= 10 or adapt your app to the new guidelines (e.g. add a menu button in your app or use an action bar). Note that you don't have to increase the target build version (project properties in eclipse) to increase the targetSdkVersion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!