I have a list that is configured to display an image and 2 textviews. I just wanted to highlight one of the elements from my list.
Firstly, I use the setSelection listview method, which finally found that it is not, since it does not work in touch mode.
So, I searched a bit and found that I would need to use the setItemChecked method. Thus, I am doing the color of the state list.
<?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 the background color of my custom list item.
From the activity of the list, I call setItemChecked (position, true) to the specific index of my list.
Unfortunately, this does not work for me. Is something missing? Has anyone been lucky with him?
Note **, I extracted data to view the list from the network. I do setItemChecked only after I have the data in my list.
My list is also in single select mode.
PH7
source share