Android Learning Note (vi) Viewpager

Source: Internet
Author: User

Use Pageradapter to implement Viewpager page swipe functionality:

1. Layout, Viewpager display by default will occupy the entire display, you need to specify the size

2. Its operation is as follows: first get the number of pages that need to be displayed through GetCount (), but not all the pages are loaded at once, instead of the default 3 pages, save the previous page and preload the next page, so each page that is not needed for 3 pages is called Destroyitem (Container,position,obj) method is destroyed, pre-loading invokes Instantiateitem (container,position) instantiation of the page Note that the object object returned by Instantiateitem is Destroyitem's object parameter, providing a convenient opportunity to delete the page, so only through Container.removeview ((View) obj) method to delete the corresponding page

Android Learning Note (vi) Viewpager

Related Article

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.