Android-ViewPager, androidviewpage

Source: Internet
Author: User

Android-ViewPager, androidviewpage

 

The ViewPager class comes from the supported libraries. Unlike the fragment class, ViewPager only exists in the supported libraries. Moreover, it is foreseeable that there is no standard ViewPager class even in later versions of the SDK.

Android programming authoritative guide

ViewPager is somewhat similar to AdapterView (the super class of ListView) to some extent ). AdapterView can be provided only by Adapter. Similarly, ViewPager also requires PagerAdapter support.

However, the coordination between ViewPager and PagerAdapter is much more complex than that between AdapterView and Adapter. Fortunately, the subclass of PagerAdapter can be used ---FragmentStatePagerAdapterTo handle many details.

FragmentStatePagerAdapter supports the combination of the two methods, namely getCount () and getItem (int ).

By default, ViewPager loads the list items on the current screen and the data on the left and right adjacent pages to implement Quick Page switching. You can call the setOffscreenPageLimit (int) method to customize the number of pre-loaded adjacent pages.

By default, ViewPager only displays the first list item in PageAdapter. You can call setCurrentItem (int) of ViewPager to specify the page to be displayed.

 

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.