KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to change color of list item when it will press For that I did like below, list_item_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> Selected <item android:state_focused="true" android:state_selected="false" android:drawable="@drawable/list_focused"/> Pressed <item android:state_selected="true" android:state_focused="false" android:drawable="@drawable/list_selected" /> </selector> I have set the color in colors.xml like below, <drawable name="list_focused">#36C170</drawable> <drawable name="list_selected">#9EC136</drawable> and in my ListView I wrote like this, <ListView android:id="@+id/list_centers_complete" android:layout_width="fill_parent" android:layout_height="wrap_content" android:cacheColorHint="@android:color/transparent" android:listSelector="@drawable/list_item_selector" /> but when I am clicking on list item, the whole background color is changed instead of only list item. How can I solve this? Is there any way? Thank you
Tags (comma-separated)
Save Edits
Cancel