I want to capture two events from a relativeLayout. When the user clicks it and when the user releases his click (like mousedown/mouseup)
rl.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//
}
});
开发者_如何学C
I tried setting up something like:
if(event == MotionEvent.ACTION_DOWN) {
}
But eclipse just throws an error about an incompatible operand type. Anyone who knows how to do this?
Try...
if (event.getAction() == MotionEvent.ACTION_DOWN) {
...
}
精彩评论