求android自定义控件如何添加点击事件,长按事件
重写了一个TextView,现在想让它在点击后触发某个操作,长按后触发某个操作
[解决办法]
让自己view实现OnGestureListener接口
在你的类中组合一个GestureDetector detector = private GestureDetector(this);对象
重写自己view的onTouchEvent(MotionEvent event)方法在此方法中调用detector.onTouchEvent(event)这个方法
这样你就可以在onLongPress这个方法中想干嘛就干嘛啦。