【发布时间】:2015-11-26 22:24:27
【问题描述】:
我在 Android Studio 中启动了一个默认的导航抽屉项目。
之后,我添加了第二个活动。但是在第二个活动的布局中,状态栏是白色的,尽管它具有与自动创建的布局相同的主题,其中 colorPrimaryDark 属性可以正常工作。
我玩了一会儿,发现一个新创建的主题 CustomTheme 与 AppTheme 有相同的项目效果很好。
所以使用android:theme="@style/CustomTheme.NoActionBar" 有效,但android:theme="@style/AppTheme.NoActionBar" 无效。
更改默认应用程序主题无效。
这是我的styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="colorPrimaryDark">#3fff04</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="CustomTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="CustomTheme.NoActionBar">
<item name="colorPrimaryDark">#ff0404</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
那么,你能解释一下这个小事吗?
非常感谢您的帮助!
【问题讨论】:
标签: android android-theme android-notification-bar android-statusbar