如何在Android上的EditText实现的DoubleClick? [英] How to implement DoubleClick on Android EditText?
本文介绍了如何在Android上的EditText实现的DoubleClick?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个活动1里面有一个的EditText。我想打开另一个活动活性2当上了的EditText用户双击。
I have an "Activity1" which has an "EditText". I want to open another activity "Activity2" when the user Double clicks on the "EditText".
推荐答案
使用这样的:
final GestureDetector gestureDetector = new GestureDetector(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);
}
});
这篇关于如何在Android上的EditText实现的DoubleClick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文