Reputation: 68750
I have an old app which now when run on tablets like the Xoom, hides the ActionBar. The app was written before the ActionBar existed so some old code is hiding the actionbar.
What in an old app can hide the ActionBar? I need to change it so that the ActionBar and therefore the menu can be shown:
Here's my very simple Theme:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="android:Theme.Black">
<item name="android:windowNoTitle">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@android:color/transparent</item>
</style>
<style name="TextViewStyled" parent="@android:style/Widget.TextView">
<item name="android:textStyle">normal</item>
<item name="android:lineSpacingMultiplier">1.22</item>
</style>
</resources>
And here's the only window settings I use:
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
requestWindowFeature(Window.FEATURE_RIGHT_ICON);
Upvotes: 1
Views: 2271
Reputation: 28932
Using android:Theme.Black
as your theme parent is what's "hiding" the action bar. The Holo and DeviceDefault theme families include an action bar by default, but the legacy theme family (from which Theme.Black derives) does not.
Use a theme declared with the same name "MyTheme" in res/values-v11/themes.xml
with a parent of @android:style/Theme.Holo
. This version of the theme will be used on devices running API level 11 (Android 3.0, where Holo and the action bar were introduced) or newer. You should similarly use Widget.Holo.TextView
instead of Widget.TextView
when declaring a custom view style to work within the Holo theme.
Upvotes: 2