Implementation of vertical viewpager for Android custom layout

Implementation of vertical viewpager for Android custom layout

design sketch:

Knowledge points involved in this custom control:

Customize the writing methods of onmeasure and onlayout in ViewGroup elastic scroller usage speed track tracker velocitytracker usage how to handle sliding event conflicts

Dispatchtouchevent: (external interception) tells the parent layout of this scrolllayout when to intercept touch events and when not to intercept touch events

Onintercepttouchevent: (internal interception) scrolllayout tells itself when to intercept the touch event of the internal sub view and when not to intercept the touch event of the internal sub view

Ideas for handling touch sliding:

summary

When you want to write an algorithm, don't worry and try to write it all at once. This often leads to blindness. You should deduce it step by step, realize the code step by step, and guide you to find the law at last, which is similar to the method of induction and summary and general term formula.

The code is as follows: (the comments are complete)

Layout file

Thank you for reading, hope to 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
分享
二维码
< <上一篇
下一篇>>