Skip to content Skip to sidebar Skip to footer

List Item Selected Behavior

When I change the background color of a list item it no longer flashes green when selected. Is there a way to retain this default behavior when the background is changed?

Solution 1:

The "green flash" is part of the background. By replacing the background (presumably, with a simple color), you eliminated the flash.

First, consider whether you should be changing the background of a list item. For example, if you are doing all of the list items this way, perhaps the ListView should have the background color.

If that does not help, you need to make the background be a StateListDrawable with the appropriate states.


Solution 2:

u can set the background resource for the view with

setBackgroundResource(android.R.drawable.menuitem_background);

and get the desired effect


Post a Comment for "List Item Selected Behavior"