You need to also create a ColorStateList
for text colors identifying different states.
Do the following:
-
Create another XML file in
res\color
named something liketext_color.xml
.<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- disabled state --> <item android:state_enabled="false" android:color="#9D9FA2" /> <item android:color="#000"/> </selector>
-
In your
style.xml
, put a reference to thattext_color.xml
file as follows:<style name="buttonStyle" parent="@android:style/Widget.Button"> <item name="android:textStyle">bold</item> <item name="android:textColor">@color/text_color</item> <item name="android:textSize">18sp</item> </style>
This should resolve your issue.