Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 状态栏颜色不为';不变_Android_Android Theme_Android Notification Bar_Android Statusbar - Fatal编程技术网

Android 状态栏颜色不为';不变

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

我在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" />

@颜色/原色
@颜色/原色暗
@颜色/颜色重音
#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"