根据本教程,我有一个简单的手势探测器,它在我的Views onTouchEvent()方法中传递了所有MotionEvent:
http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html
我的代码示例,在触摸屏幕时在手指周围绘制一个圆圈:
@Override
public boolean onTouchEvent(MotionEvent ev) {
// send the touch event to the gesture detector
if (mBuildupDetector.onTouchEvent(ev)) {
Log.d(LOG_TAG, "onTouchEvent(): Gesture consumed.");
} else {
Log.d(LOG_TAG, "onTouchEvent(): Gesture not consumed.");
}
switch (curAction) {
case MotionEvent.ACTION_DOWN: {
drawCircle();
}
}
}
然后是手势检测器的私有子类:
private class BuildupListener extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onDown(MotionEvent ev) {
Log.d("BuildupListener", "onDown(): Triggered.");
return true;
}
}
因此,当用户触摸屏幕,生成一个动作事件时,我感到很惊讶该手势确实被“消耗”了,我可以在GestureDectector的onDown方法中改变圆的直径。但是,没有从onDown写出日志记录,即使它似乎被调用并执行。
我是否遗漏了一些关于日志记录以及如何从内部私有子类或手势检测器进行日志记录的基本知识?
谢谢,
保
答案 0 :(得分:0)
发现问题,我相信这是LogCat的一个错误。从Eclipse中删除LogCat选项卡并重新启用它会导致所有日志记录按预期显示。