Friday, November 18, 2011

[android-developers] Using ActionBar while remains compatible with Android 2.x?

Can I show the menu in ActionBar in Honeycomb while the app remains
compatible with Android 2.x?

In http://developer.android.com/guide/topics/ui/actionbar.html it
seems that this can be done:
--
Beginning with Android 3.0 (API level 11), the action bar is included
in all activities that use the Theme.Holo theme (or one of its
descendants), which is the default theme when either the
targetSdkVersion or minSdkVersion attribute is set to "11" or greater.
For example:

<manifest ... >
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="11" />
...
</manifest>
In this example, the application requires a minimum version of API
Level 4 (Android 1.6), but it also targets API level 11 (Android 3.0).
This way, when the application runs on Android 3.0 or greater, the
system applies the holographic theme to each activity, and thus, each
activity includes the action bar.
--

While I tried this in my 2.x apps, the menu disappeared but no
ActionBar is shown (so I lost access to the menu). What shall I do?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment