How to prevent the textColor from changing with the Dark Mode of the smartphone in AndroidStudio?

663 views Asked by At

I am making an app and I have realized that if the smartphone is in night mode the textColor changes automatically and that makes it not visible as can be seen in the following images.

Image with DarkModeOn

Image with DarkModeOff

I have looked for information and I have configured the colors.xml file so that it has the night option and that the colors are the same, as you can see below, but also the textColor changes and only does it when I perform the test on my smartphone, not on the emulator device.

values\colors.xml

<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="colorPrimary">#008577</color>
        <color name="colorPrimaryDark">#00574B</color>
        <color name="colorAccent">#D81B60</color>
        <color name="textColor">#1C2833</color>
        <color name="textQuestions">#1C2833</color>
        <color name="hintColor">#551C2833</color>
        <color name="buttonColorLight">#F7FFF6</color>
        <color name="buttonColorDark">#1c2833</color>
        <color name="wrongColor">#B71C1C</color>
        <color name="rightColor">#1CB71C</color>
    </resources>

values\colors.xml(night)

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#008577</color>
    <color name="colorPrimaryDark">#00574B</color>
    <color name="colorAccent">#D81B60</color>
    <color name="textColor">#1C2833</color>
    <color name="textQuestions">#1C2833</color>
    <color name="hintColor">#551C2833</color>
    <color name="buttonColorLight">#F7FFF6</color>
    <color name="buttonColorDark">#1c2833</color>
    <color name="wrongColor">#B71C1C</color>
    <color name="rightColor">#1CB71C</color>
</resources>

Can you tell me what to do? I just want to prevent the textColor from changing and staying the same regardless of the mode.

0

There are 0 answers