我在android材料设计工作。我尝试设计应用,但 ColorPrimary 会在每个版本中发生变化,但 ColorPrimaryDark 仅在API级别22中发生变化。
styles.xml it contains code for styles.xml under the res directory
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/accentColor</item>
<item name="colorButtonNormal">@color/buttonColor</item>
</style>
</resources>
v21\styles.xml
它包含res目录下的v21 \ styles.xml的代码
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:colorPrimary">@color/primaryColor</item>
<item name="android:colorPrimaryDark">@color/primaryColorDark</item>
<item name="android:colorAccent">@color/accentColor</item>
<item name="android:colorButtonNormal">@color/buttonColor</item>
</style>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primaryColor">#3F51B5</color>
<color name="primaryColorDark">#303F9F</color>
<color name="accentColor">#F44336</color>
<color name="buttonColor">#F44336</color>
</resources>