KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Button selectors allows to define a background for each state of the button, but how can the button's text style be defined for each state? My objective is to grey out a button when disabled. So I set a greyed out background to the disable state of the button, but the only way I found to also grey out the text is to change it's color dynamically when I disable the button... Anybody can help? Thanks <style name="srp_button" parent="@android:style/Widget.Button"> <item name="android:background">@drawable/btn_default</item> <item name="android:textColor">#ffffff</item> <!-- How to specify different color for different state? --> <!-- more stuff --> </style> drawable/btn_default.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true"><shape> <solid android:color="@color/pink" /> <corners android:radius="6dp" /> </shape></item> <item><shape> <solid android:color="#000000" /> <corners android:radius="6dp" /> </shape></item> </selector>
Tags (comma-separated)
Save Edits
Cancel