I treid to change the background color of the Action bar to another color istead of the default color. I am using :
implementation 'com.google.android.material:material:1.2.0-alpha05'
... values/styles.xml:
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryDarkColor</item>
<item name="colorPrimaryVariant">@color/primaryLightColor</item>
<item name="colorOnPrimary">@color/primaryTextColor</item>
<item name="colorSecondary">@color/secondaryColor</item>
<item name="colorSecondaryVariant">@color/secondaryDarkColor</item>
<item name="colorOnSecondary">@color/secondaryTextColor</item>
<item name="android:windowBackground">@color/activityBackground</item>
</style>
</resources>
...and:night/colors.xml
<color name="primaryDarkColor">#430F58</color>
<color name="primaryColor">#F7F2F8</color>
<color name="secondaryColor">#9e9e9e</color>
<color name="secondaryDarkColor">#707070</color>
<color name="primaryTextColor">#eceff1</color>
<color name="activityBackground">#121212</color>
...mainActivity.kt:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
}[enter image description here][1]
}
ll works great,but the color of my action bar remaimining black all time.
Can you help me ? thanks