Slide of view
There are three ways to realize the swipe of a view:
1. Use the Scrollto/scrollby method provided by the view itself to achieve sliding
2. Apply panning to view by animation to achieve sliding
3. Sliding the view by changing the layoutparams of the view to make it re-layout
First, the use of Scrollto/scrollby
Scrollto and Scrollby can only change the location of the view content and not change the view's position in the layout
MSCROLLX: Swipe from left to right for negative values and vice versa
Mscrolly: Swipe from top down to negative value, inverse positive
Second, the use of animation
Use animations to move the view, primarily manipulating the Translationx and Translationy properties of the view, either with traditional view animations or by using property animations
Third, change the layout parameters
Change the layout parameters, i.e. change the layoutparams.
Iv. Comparison of various sliding modes
1.scrollto/scrollby: Easy to use, suitable for sliding the view content
2. Animation: simple operation, mainly for the view without interaction and to achieve complex animation effects
3. Change layout parameters: The operation is slightly more complex, suitable for interactive view
Slide of view