Slide of view

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.