I am developing an app using Kotlin with webview, but when running the app the top bar gets the color below:
How do I change to black? I have been in themes.xml, changed colors based on colors.xml, but it didn't work.
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.NameApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
I saw you have this link, but I don't know how to apply in Kotlin. Change top app color
Excuse my Spanish.
The status bar color is changed with
colorPrimaryDark
, add this element to your style:Check this image, it will give you an idea of what value to use in each case: