android honeycomb menu button target

筅森魡賤 提交于 2019-12-18 13:16:30

问题


I am trying to get my app to be backward compatible so i need to show the menu button since we used the menu button in our app on previous versions.

So I was reading and it says that if your target is 11 (3.0) than you don't get the menu button but it your target is 10 they you do.

But the issue is I am using fragments so my target has to be 11.

Any thoughts.


回答1:


Ordinary options menus will appear regardless of Android version. If you have:

android:targetSdkVersion="11"

then the options menu will appear in the action bar on Android 3.0+ devices. All items in the options menu will be available when clicking the "overflow" button in the upper-right corner. Your options menu will appear normally on Android 1.x and 2.x devices, even if you have android:targetSdkVersion="11" in your <uses-sdk> manifest element.

If you overrode the MENU button to have other behavior, you will need to create some other trigger for that behavior for API Level 11 and higher. Overriding the MENU button was never a good idea to begin with, and as you can see, it is even less of a good idea now. I know of no way to get a MENU button on an Android 3.0 device if you have android:targetSdkVersion="11".




回答2:


One thing that worked for me in order to get older Options Menu on Tablet devices was after I used the following:

minSdkVersion="11"
targetSdkVersion="10"

I think what helps over here is that I am stating to system that app has been tested against API 10 so I get older Options menu.

And because my app is meant for tablets only, keeping minSdkVersion to 11 also prevents it to be installed on the smaller devices. I know, I might still have to see the case of installation for smaller devices having ICS.



来源:https://stackoverflow.com/questions/5279148/android-honeycomb-menu-button-target

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