Detailed examples of Android Sliding Monitoring

Detailed examples of Android Sliding Monitoring

Absrtact: scollby and scollto are the movement of content, and view. Scollyby is the movement of the content of view

View, scallto is the movement of the content (moving to the specified location), and view. Scallyby is the movement (moving distance) of the content of the view

In the secondary activity, when the finger clicks textview, is it a ViewGroup response or a textview response?

Code practice:

Override ontouchevent() in activity:

Add sliding listener in textview:

When both return values are false:

First respond to the textview touch event, and then respond to the activity touch event

When the return value of the touch event of the activity is true:

ditto

When the return value of the textview touch event is true:

Only respond to textview touch events

Summary:

The return value of ontouhevent: true means that the touch event will not be passed up and the touch event will be consumed; false means that the touch event will continue to be passed without blocking (also consuming the event)

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>