How can I create a drawable which changes depends on state AND also overlay a image?

Posted by michael on Stack Overflow See other posts from Stack Overflow or by michael
Published on 2010-04-23T07:21:46Z Indexed on 2010/04/23 7:23 UTC
Read the original article Hit count: 202

Filed under:

Hi,

I have a TextView which has a drawable changes depends on state:

<TextView android:background="@drawable/textbackground"...>

And my textbackground.xml is

<selector>
<item android:state_focused="true" android:drawable="@drawable/highlightborder" />
</selector>

And highlightborder.xml is

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<stroke android:width="1dp" android:color="#FFFF0000" />
<solid android:color="@android:color/transparent"/>
</shape>

Now, how can I add an png to the background of TextView while should the highlightborder when it has focus?

Thank you.

© Stack Overflow or respective owner

Related posts about andriod