Android - Textview change color on changing of state -


how can apply color on various states(focused, pressed, enabled) of textview?

i have referred this: http://developer.android.com/reference/android/content/res/colorstatelist.html , not know how can apply color state list textview? or there other way ?

update:

i want change background color.

create new new xml (in drawable folder). color can specify image each event state
, can can set xml background

if xml 'res/drawable/abc.xml' set background as

android:background="@drawable/abc" 

edited add color in state xml
our xml, res/drawable/abc.xml

<?xml version="1.0" encoding="utf-8"?>    <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true"        android:drawable="@color/gray" /> </selector> 

then declare gray in your res\values\strings.xml

<color name="gray">#808080</color> 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -