我想对 TextView 上的 Click 和 DoubleClick 事件执行不同的操作。
我正在尝试使用以下代码:
tvcurrentlocation.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "google map started", Toast.LENGTH_SHORT).show();
}
});
@SuppressWarnings("deprecation")
final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
public boolean onDoubleTap(final MotionEvent e) {
Toast.makeText(getApplicationContext(), "inside doubletap", Toast.LENGTH_SHORT).show();
Log.e("", "Open new activty here");
return true;
}
});
tvcurrentlocation.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
请帮忙!!!
问候,
苏拉布