Android 状态栏颜色不为';不变
我在Android Studio中启动了一个默认的导航抽屉项目。 之后,我添加了第二个活动。但是在第二个活动的布局中,状态栏是白色的,尽管它的主题与自动创建的布局相同,Android 状态栏颜色不为';不变,android,android-theme,android-notification-bar,android-statusbar,Android,Android Theme,Android Notification Bar,Android Statusbar,我在Android Studio中启动了一个默认的导航抽屉项目。 之后,我添加了第二个活动。但是在第二个活动的布局中,状态栏是白色的,尽管它的主题与自动创建的布局相同,colorPrimaryDark属性工作正常 我仔细研究了一下,发现一个新创建的主题CustomTheme,它与AppTheme具有相同的项目,效果非常好 因此,使用android:theme=“@style/CustomTheme.NoActionBar”有效,但android:theme=“@style/AppTheme.No
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" />
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
#3fff04
假的
真的
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
#ff0404
假的
真的
你能给我解释一下这件小事吗
非常感谢你的帮助
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="APPActionBar" parent="@style/AppBaseTheme">
<item name="colorPrimary">@color/action_bar_clr</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="actionOverflowMenuStyle">@style/PopupMenu</item>
</style>
<style name="PopupMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:textColor">@color/white</item>
<item name="android:popupBackground">@color/menu_bg</item>
</style>
使用与value-11和value-14文件夹相同的样式
android:theme="@style/APPActionBar"