开发者

Does using the ActionBar in Honeycomb really mean i have to create an extra App?

开发者 https://www.devze.com 2023-02-13 07:20 出处:网络
Last week i began the honeycomb update for my app and since then the documentation has become available. One of the really big things to change in my app is the use of the ActionBar. I am a little dis

Last week i began the honeycomb update for my app and since then the documentation has become available. One of the really big things to change in my app is the use of the ActionBar. I am a little disappointed about the following sentence from the doumentation:

However, if you want to use Action Bar APIs, such as to add tabs or modify Action Bar styles, you need to set the android:minSdkVersion to "11", so you can access the ActionBar class.

开发者_C百科

Does that really mean i have to create an extra app if i want to take advantage of the ActionBar or is there some way around this?


No, that bit of the documentation is incorrect. You need android:targetSdkVersion="11", plus the proper settings in your options menu XML resource, to use the action bar.

If you wish to use features of the action bar that require access to methods that only exist on API level 11 and higher, you will need to take care not to execute that portion of your code on older devices. Here is a sample project where I put a custom View into the action bar, but I only try to configure that View on Honeycomb or higher. This same code works fine on older versions of Android, back to 1.6.

0

精彩评论

暂无评论...
验证码 换一张
取 消