Reputation: 402
I have this drawable:
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="@android:color/transparent" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="#8FED85"
android:endColor="#4CD43D"
android:angle="270" />
</shape>
</item>
</selector>
And it is shown by using this:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:enterFadeDuration="@android:integer/config_longAnimTime"
android:exitFadeDuration="@android:integer/config_longAnimTime">
<item android:drawable="@android:color/transparent" android:state_focused="true" android:state_pressed="false"/>
<item android:drawable="@android:color/transparent" android:state_pressed="true"/>
<item android:drawable="@drawable/listview_selector"/>
</selector>
And here is the listview:
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView9"
android:divider="#fff"
android:cacheColorHint="#00000000"
android:dividerHeight="0.9dp"
android:listSelector="@drawable/list_selector_animation"
android:choiceMode="singleChoice"
android:layout_marginBottom="50dp"
android:background="#fff"
>
</ListView>
The drawable is a green "box" that shows up in a listview when an item inside the list is selected, what i would like to do is to also show a text inside the drawable like "tap again to send" or something like that, any tips on how i could add the text inside the drawable shape?
Upvotes: 1
Views: 3977
Reputation: 13937
you can put this drawable onto a button, as its background, and use its setText to add the text
Upvotes: 1