I basically want to customize list item`s background color while it is touched. I tired writing a listener but it seams that I made some kind of mistake or misunderstood the concept of these actions.
v.setOnTouchListener( new TextView.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
v.setBackgroundColor(Color.RED);
break;
case MotionEvent.ACTION_UP:
v.setBackgroundColor(Color.WHITE);
break;
}
return false;
}
}
);
Default color is light blue. I want to change it for every list item. This code changes items color to red when touched but it does not change back after that.