Android: change button background/text/compoundDrawables with selector XML -


i have been using selector drawables make button change background according state.

however, want change text color , left compound drawable background. default selector xml atrribute not contain "android:textcolor" or "android:drawableleft" assigned.

i know can achieve extend own button class, there clean way out?

i not sure drawables changing textcolor depending upon button state, use selectors below,

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" >     <item android:state_pressed="true" android:color="@color/color_light_green"></item>     <item android:color="#fff"></item>     //state want </selector> 

and apply textcolor attribute in xml as,

android:textcolor="@drawable/selector_btn_text_color" 

eclipse doesn't auto suggest color attribute in selector can it. :)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -