I have a class extends ViewGroup
and want to get every MotionEvent
from it. So far I have this:
class TestViewGroup extends ViewGroup {
public TestViewGroup(Context context) {
super(context);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.d("TestViewGroup", "X: " + (int)event.getX() + " Y: " + (int)event.getY());
return true;
}
}
The onTouchEvent(MotionEvent event)
method is able to capture a MotionEvent
every time I place my finger on the screen. But if I move my finger around the screen while my finger is still down, it won't continue to trace the coordinates of my finger. I know that in a class that extends a View
, it is possible to keep tracing the finger as it moves through the View
. I'm just wondering how it is possible to apply the same idea to a ViewGroup
.