Summary of small knowledge points
1.
How is the Motionevent.action_cancel event triggered in Android?
For this question, the description of the Android documentation is very brief and it is difficult to see it clearly. A foreign page said more detailed, written here to share to you:
This is the original:
You receive this if a parent takes possession of the motion, for example when the user has dragged enough across a list View or scroll view that it'll start scrolling instead of letting you press the buttons inside of it.
The meaning is this:
This event is triggered when your finger (or other) moves the screen, such as when your finger drags a ListView or a scrollview over the screen instead of pressing the button above.
2.
Computescroll: The main function is to calculate the amount of displacement to drag, update the background, set the screen to be displayed (Setcurrentscreen (mcurrentscreen);).
Reasons for overriding Computescroll ()
Call Startscroll () will not have scrolling effect, only in computescroll () get scrolling condition, make scrolling response
Computescroll This method is called when the parent control executes Drawchild
Scroller is not a view, it is not responsible for any display work, just calculates the scrolling process.
You can use Startscroll (int startX, int starty, int dx, int dy) to specify the starting position and the X/Y axis displacement.
Then call Computescrolloffset () to calculate the current position, return "true" for scrolling, and return "false" to represent the end of scrolling
Finally call Getcurrx ()/getcurry () to get the current coordinates and then draw your view based on this coordinate