Adel, first click problem, or donβt you get a click at all?
, , . , , click, .
private class CustomTouchListener implements OnTouchListener {
@Override
public boolean onTouch(View v, MotionEvent event) {
TextView tv = (TextView) v.findViewById(R.id.single_line_text);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
tv.setTextColor(COLOR_WHEN_PRESSED);
} else if (event.getAction() == MotionEvent.ACTION_UP) {
tv.setTextColor(COLOR_WHEN_RELEASED);
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
tv.setTextColor(COLOR_WHEN_RELEASED);
}
return false;
}
}
, .
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"
, !!!
EDIT: , DOWN, UP. DOWN , UP. , , .