I am working with XOOM and trying to hide action bar. So i follow the instruction did the following in manifest file:
uses-sdk android:minSdkVersion="11" android:targetSdkVersion="11"
also set activity theme.
android:theme="@android:style/Theme.Holo.NoActionBar"
unfortunately i can still see the action bar. so i remove the holo action part from my manifest and added following code
ActionBar actionBar = getActionBar();
actionBar.hide();
getting null pointer exception from hide() method. so i understand getActionBar() is returning null. Now i am curious what i am missing?
Theme.Holo.NoActionBar isn't public in the framework- Instead, you can declare your own style like this:
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
I came to exactly the same conclusion. If you can't make the ActionBar show on the screen it is most likely either :
window has no title; ActionBar is essentially a glorified title bar, thus no title= no ActionBar, although this is nowhere mentioned in the docs
you tried to call the getActionBar() method prior setting the content view in the activity. In this case, this method returns null. Again, nowhere mentioned in the docs, and if you try to construct/modify the ActionBar as a part of the custom view constructor, you are out of luck.
More about my explorations of ActionBar in Honeycomb can be found on my blog here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With