I have a listview which is customized to display an image and 2 textview. I just simply wanted to highlight one of the item from my list.
Firstly, I go with setSelection method of listview which i finally found out it is not the way as it is not working in touch mode.
So, I do some searching and found that I'd need to use setItemChecked method. Thus, I make a state-list color.
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@color/checkbox_bg_fcs" />
<item android:drawable="@color/WHITE" />
</selector>
I used it to set background color of my customized list item.
From List activity, I call setItemChecked(position,true) to a specific index of my listview.
Unfortunately, it doesn't seem to work for me. Is there anything missing? Anyone got luck with it?
Note**, I did retrieve data for list view from network. I do setItemChecked only after i have data in my listview.
My listview is in single choice mode too.
<item android:drawable="@color/WHITE" />
do? – Trichomoniasis