这是我的 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/