I've made a ListView in my project, but I find that when I drag it up and down or I click one item, the item's background will change to be yellow(the default background in Android?). But I don't wanna to be 开发者_如何学Cthat, I wanna: No change about the item's background when drag or click it. Can any way make it?
Specify a background (Color/Drawable) to the List-Item template.
Suppose you are using the default simple_list_item, it consists of only one TextView, add a background to it (instead of the default):
<TextView
android:background="#000"
...
In this case, it will not change background when clicking or dragging.
-- Update --
In Android, the background is by default some kind of "StateListDrawable" and it will response to "State" Changes in its appearance. Specifying a background breaks the default implementation and make the background to be a simple Drawable without states.
精彩评论