Black text on a dark background on Nougat (android.R.layout.simple_spinner_item)

I have a basic piece of code in the welcome action that just binds the list adapter as usual:

final ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, android.R.id.text1); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 

This one was used until I upgraded to API level 25 . At this point, without any other changes, the spinner dropdown text became unreadable:

black text on a dark background android 7

My parent theme is "Theme.AppCompat.Light.NoActionBar", but again, I do not play with colors and nothing has changed since it showed correctly (API <25). Any idea?

I know that I can fix it with setTextColor() inside spinner.setOnItemSelectedListener() , but the main thing is to understand why it works, but now it’s not, because it may be a sign of something conceptually wrong on my side, or even some kind of Android glitch. Infact, I noticed the same problem (black text on a dark background) on fairly standard widgets / applications, for example, by default for Cyanogen / LineageOS:

black text on a dark background android 7

+14
android android-arrayadapter android-spinner
source share
1 answer

I had the same problem. Your color definition could be android:textColor="#FFFFFFFF" . When I fixed it as android:textColor="#FF000000" , it worked fine. Or you can use android:textColor="#FFFFFFFF" .

I heard from my collaboration that the first 2 hexadecimal values ​​were changed. Changed version of SDK 24.

0
source share

All Articles