I have a View and I need to detect a single tap on a LinearLayout. I don't care about movements, All I want to dete开发者_JAVA百科ct is a single tap. Basically a touch detection just like the touch detection on buttons. How can I achieve this?
myView.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
// This gets called so many times on every movement
return true;
}
});
I'm pretty sure, this would work aryaxt:
myView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// myView tapped //
}
});
精彩评论