I have posted the same problem a couple of times but it hasn\'t yet been resolved. I have a ListFragment
and I want to highlight the selected item in the list.
I wasn't getting what I wanted so I kept on digging and came up with a "cheap" solution which might not be the best practice but does the job.
I wanted the item to be highlighted when selected and the color should go away when other item is selected from the listFragment.
This is what worked for me- I defined a static View V;
and initialized it V = new View(getActivity());
Then inside my
onListItemClick(ListView l, View v, int position, long id)
V.setBackgroundResource(0);
v.setBackgroundResource(R.color.BLUE);
V = v;