Mehdi Haghgoo
Mehdi Haghgoo

Reputation: 3484

Why TextView shows text in black on Android Oreo when using Theme.AppCompat

I am using Theme.AppCompat as the parent style for my AppTheme theme. This is the contents of my style.xml file:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>

    </style>

</resources>

The problem is when I run my application on a device with Android 6.0 it displays fine, but when on Oreo emulator, it shows like this:
enter image description here

The text is black on a black background. I have not set any text color or background color, other than using Theme.AppCompat as stated above. Any ideas?

Upvotes: 1

Views: 325

Answers (1)

Muhammad Saad Rafique
Muhammad Saad Rafique

Reputation: 3189

Add this to your style:

<item name="android:textColor">yourColorGoesHere</item>

<item name="android:textColorPrimary">#295055</item>

Instead of #295055 you can give any color you want.

Upvotes: 1

Related Questions