开发者

Honeycomb Action Bar not showing (baffled)

I am completely baffled. I created an application with minSDK=4 and targetSDK=11. Compiled and ran on the Xoom tablet. I am 开发者_如何学Pythonnot getting an Action Bar and cannot figure out what I have done wrong. I have been staring at the screen for hours and don't know what I have done that would have caused the bar to disappear. Help! Any suggestions on why I am not seeing the Action Bar?


You need to declare android:theme="@android:style/Theme.Holo" for Activity in Manifest xml.

The dev guide says like you only need to set the target SDK version, but it does not work.


I'm quoting from here: "If you are using the Support Library APIs for the action bar, then you must use (or override) the Theme.AppCompat family of styles (rather than the Theme.Holo family, available in API level 11 and higher)."

I used android:theme="@style/Theme.AppCompat" in my manifest and the action bar appeared.


Romulus' answer, forcing the App to use the Holo theme will work but it results in a compile error if your minSDK is less than 11.

Check if you have defined a theme in the AndroidManifest:

android:theme="@style/XXXXXXXXXXXXXXXXX"

That means you're forcing the App to use a particular theme, so the action bar might not appear on Honeycomb or higher devices (it depends if the theme specifies an action bar). Delete this statement to cause the App to use the default device theme, so the Settings menu appears on pre-Honeycomb devices and the action bar appears on post-Honeycomb devices. Job done. Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜