How To Create A State List Drawable For My Listview Items?
I have a custom ListView selector which draws on top of a ListView. It works fine, but I want the text inside of the listview to turn white. How can I do that?
Solution 1:
You need to apply specific color or selector to each list item.
I have something like this (abreviated)
layout/dash_item.xml
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"style="@style/DashboardListItem">
... Your text components etc ....
color/dashboard_selector.xml
<selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_enabled="false"android:state_focused="true"android:drawable="@android:color/transparent" /><itemandroid:state_pressed="true"android:drawable="@color/dash_border_color" /><itemandroid:state_focused="true"android:drawable="@color/dash_border_color" /></selector>values/style.xml
<stylename="DashboardListItem"><itemname="android:background">@color/dashboard_selector</item></style>You probably will need to play with it to figure where exactly apply things. It can probably be simplified. Anyway, it's just a direction since I don't know your specific requirements.
Post a Comment for "How To Create A State List Drawable For My Listview Items?"