So, I've been working on an app and changed the styles.xml so it has custom colorPrimaryDark, colorPrimary and colorAccent. In some activities I've also added the android:background="@color/some_color" to their main layout so it overrides the default one.

The thing is that is being applied in the preview window but when I run it on my phone that doesn't happen, the colors stay the same instead of changing to the ones I'm telling it to.

What am I doing wrong?

Here are some parts from my styles.xml and a random activity:

styles.xml:

 <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
    <!-- 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:fontFamily">@font/montserrat</item>
</style>

activity:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark">

Related posts

Recent Viewed