【发布时间】:2017-01-30 11:29:43
【问题描述】:
我想在双击 TextView 时触发某些事件。
final GestureDetector gestureDetector = new GestureDetector(context,new GestureDetector.SimpleOnGestureListener() {
public boolean onDoubleTap(MotionEvent e) {
Log.e("", "Open new activty here");
return true;
}
});
TextView tv = (TextView) findViewById(R.id.editTextID);
tv.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
这会返回 ontapevent
【问题讨论】: