Problem with difference in color of Android app. Android Studio appears one way and my phone is totally different

Asked

Viewed 12 times

-1

Hello, all right? I’m starting now in Mobile Development. My problem is the following:

I created a simple app for testing, in Android Studio it gets the colors the right way I want, but when I install it on my phone, yellow gets a negative effect and the color is almost black instead of yellow. I’m having trouble solving it. The whole project was created by the IDE and I just modified it... The Styles file didn’t exist, so I created one from scratch. Follow him down:

<?xml version="1.0" encoding="utf-8"?>


<resources>
    <style name="AppTheme" >

    <!-- Create your theme here-->
        <item name="colorPrimary">@color/white</item>


    </style>
    
    <style name="Operators_Button">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_weight">1</item>
        <item name="android:background">@color/orange_red</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">28dp</item>
        <item name="android:gravity">center</item>
        <item name="android:textStyle">bold</item>
        <item name="android:layout_margin">0.5dp</item>
    </style>
    
    <style name="Numbers_Button">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_weight">1</item>
        <item name="android:background">@color/yellow</item>
        <item name="android:textColor">@color/black</item>
        <item name="android:textSize">28dp</item>
        <item name="android:gravity">center</item>
        <item name="android:textStyle">bold</item>
        <item name="android:layout_margin">0.5dp</item>
    </style>



</resources>```

1 answer

0

I realized my phone was in Dark mode, deactivated and the colors were normal as I expected. The question now is to understand how to make my app not be modified by the "dark mode" option of the phone.

  • This is device setup, you can’t go against it. If it were possible, it would be a disrespect to the user’s choice.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.