まずあなたがこの
private GestureDetector gestureDetector;
gestureDetector = new GestureDetector(this, new SingleTapConfirm());
ようGestureDetectorを必要とするには、今すぐあなたのOnTouchListener
View.OnTouchListener simpleMethod = new View.OnTouchListener() {
if (gestureDetector.onTouchEvent(event)) {
// single tap code goes here, its single tap click
// its like Onclick for your view
} else {
// your code for move and drag, touch
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
// your action down action
break;
case MotionEvent.ACTION_MOVE:
// your action move code here
break;
default:
return false;
}
return true;
}
}
};
が最後にあなたのビュー
にタッチリスタを追加書き込み
SimpleOnGestureListener
GestureDetector
から
private class SingleTapConfirm extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onSingleTapUp(MotionEvent event) {
return true;
}
}
を追加します。
fab.setOnTouchListener(simpleMethod);
'your_liner_layout.setOnClickListener(new View.OnClickListener(){};' – Kathi