android honeycomb menu button target

2019-02-06 18:19发布

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.

2条回答
唯我独甜
2楼-- · 2019-02-06 18:39

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".

查看更多
一夜七次
3楼-- · 2019-02-06 18:55

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.

查看更多
登录 后发表回答