I have a ListView and I wanted to change the default blue highlight when it is set to listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
to a custom image not only when the item is selected/pressed but also stays selected/pressed by this code:
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
v.setBackgroundResource(0);
view.setBackgroundDrawable(getResources().getDrawable(
R.drawable.list_item_highlight_short));
v = view;
}
The problem is that if I have 20 item in my ListView, some items that are not within the view are still highlighted and not included in v.setBackgroundResource(0);
How could I remove the BackgroundResource of all items in the ListView so that I could set the clicked item a custom image background to indicate "selected" state?