How to change background image and text of button on click in Android? -
i have idea of how apply selectors buttons when need change background image of buttons. want change text color when button pressed. there similar way creating selector xml that? other option is, guess, changing text color in onclick method wanted know if there other way or better way of doing same.
thanks
i guess, changing text color in onclick method
just create proper selector , assign textview color property
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="true" android:color="somecolor" /> <item android:state_focused="false" android:state_pressed="true" android:color="somecolor" /> <item android:color="somecolor" /> </selector>
and usage:
android:textcolor="@drawable/yourselector"
we need change background image of buttons
it's same background in item you'll change color property drawable.
Comments
Post a Comment