android - statusBar 颜色与我的 colorPrimaryDark 颜色不同

标签 android android-layout android-styles

这是我的 colors.xml,其中 colorPrimaryDark 是橙色的:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#ffbf80</color>
    <color name="colorAccent">#FF4081</color>
</resources>

我的 statusBar 仍然是黑色的,即使我已经为我的 colorPrimaryDark 设置了橙色。这是为什么?

这是我的 styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="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>
        <item name="android:colorForeground">@color/colorPrimaryDark</item>
    </style>

</resources>

list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.zorgan.app" >
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.NoActionBar" >
        <activity android:name=".MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    </application>

</manifest>

最佳答案

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

深色操作栏是罪魁祸首,请尝试设置无操作栏。 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 请记住,您将经常制作自定义工具栏。

请按照本教程获取更多指导 http://www.android4devs.com/2014/12/how-to-make-material-design-app.html

也切换这个android:theme="@style/Theme.AppCompat.NoActionBar" >android:theme="@style/AppTheme"

关于android - statusBar 颜色与我的 colorPrimaryDark 颜色不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42950270/

相关文章:

android - 在 Android 中设置 >24 小时倒数计时器的最佳方法?

java - 如何将图像适配器(它是无限循环 View )放置在 fragment 中?

不同分辨率的 Android 布局

android - picasso 什么时候刷新图像缓存

android 线性布局按钮

android - 在 Google Play Integrity 中生成 Nonce 的正确方法是什么

java - 没有运行第一个 Activity

android google plus xml 中的登录按钮样式

安卓|使用 styles.xml 更改 TextInputLayout 的主题

android - 在自定义样式中使用维度