[英]Android 3.0+ ActionBar doesn't show
我的应用与Android 2.x至4.x兼容:
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15"
/>
对于我的应用程序主题,我使用的是Android开发者网站上建议的选择器主题:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/LightThemeSelector"
>
我有几个/ res / values- *目录来控制不同大小/版本的Android设备上的样式。 例如,在/res/values-large.xml中,我有选择器选择旧的android Light主题:
<style
name="LightThemeSelector"
parent="android:Theme.Light"
>
<item name="android:windowNoTitle">true</item>
</style>
但是,在我的/res/values-sw720dp.xml(和/res/values-sw600dp.xml)中,选择器选择了新的android Holo.Light主题,该主题应会自动为我提供一个ActionBar:
<style
name="LightThemeSelector"
parent="android:Theme.Holo.Light"
>
<item name="android:windowNoTitle">true</item>
</style>
但是,当我在XOOM模拟器上运行该应用程序时,它没有显示ActionBar。 如果将清单文件设置为直接指定Theme.Holo.Light,则在XOOM模拟器中运行时会得到ActionBar。
您的主要问题是以下行:
<item name="android:windowNoTitle">true</item>
将其设置为true时,它将隐藏ActionBar。
只需将其设置为false
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.