Warm tip: This article is reproduced from serverfault.com, please click

View.onTouchEvent only registers ACTION_DOWN event

发布于 2011-06-17 20:57:10

I'm implementing a custom TextView and I want to do some action when the view is touched. I figured the onTouchEvent method would give me the full range of touches on the view without having to use setOnTouchListener (I'm trying to do all my work inside the view instead of in the activity so it's portable), but the only touch event registered is ACTION_DOWN. If I set an OnTouchListener in the activity using this, I get the full range of touch events, but onTouchEvent doesn't.

Anyone know why this is the case, or can anyone offer me a solution that doesn't involve using setOnTouchListener (Which would prevent the implementing activity from setting its own listener)?

Questioner
Jason Robinson
Viewed
0
hackbod 2011-06-18 05:11:26

You need to return true to get the following events after a down.