Change a color in Android Studio theme.xml

Issue

I’m trying to change the color behind the buttons, so it’s not #FFFFFF anymore, when the theme is set on Light theme, but I can’t figure out the name of the item I need to add.
Thanks in advance!

Here is a screenshot of the app:

and here is the code that I’m trying to change:

    <!-- Base application theme. -->
    <style name="Theme.MyCalculator" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/primaryOrange</item>
        <item name="colorPrimaryVariant">@color/primaryOrange</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>

Solution

Thanks everyone! I solved it by putiting android:background in the activity_main.xml in the main LinearLayout tag.

Answered By – Toma

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *