The 1 Ferris wheel control can be rotated by touch, but the direction of the child view is maintained during the rotation.
2 Ferris wheel Control in the touch of rotation, the basis of inertia rotation is the placement of automatic control parts, using a triangular function to determine the sub-view
Center point Position, note that in the analysis phase we take the center point of the Ferris wheel as a reference point (0,0), when writing code, remember
Offset to the top left of the control.
3 in touch rotation and inertia rotation, we need to change the position of all children, in fact, the center point of the Child and
The angle of the center line, but because the angle interval is equal, it only needs to change the angle of the first child, and then the other child and the second
A child maintains an angle interval and then calls Requestlayout to rearrange the child.
4 touch rotation and inertia rotation, both use the Gesturedector to help us determine the type of touch event and
Supply the parameters that we need.
5 in touch rotation, by calculating the angle of the current point and the angle of the previous point, and then calculating the difference of two points, we can
To know how many angles need to be rotated.
6 The more difficult place is to convert the inertial sliding pixel speed into angular velocity, for students who have not studied calculus can
Can not imagine. We then used the value animation to constantly change the angle to simulate the rotation, and the deceleration interpolator was used to simulate deceleration.
7 because the touch event handling of the Ferris wheel is written in the Ontoucheven,t method, if the child control consumes the touch
The Ontoucheevent method of the Ferris wheel is not called, so we need to
The Onintercepttouchevent method returns ture, and then detects the Click event sent to the child who was clicked.
Custom controls: The implementation of the Ferris wheel 1