Android Development Viewpager and Pageradapter

Source: Internet
Author: User

Viewpager, website link--http://developer.android.com/reference/android/support/v4/view/viewpager.html

Viewpager, located in Android.support.v4.view.ViewPager.

1. Inherit from viewgroups, inherit the relation please crossing net

2. The main use of the A.app in the Guide page of the show B. A frame that can slide left and right

Viewpager Features:

1) The Viewpager class inherits directly from the ViewGroup class, all of which is a container class where additional view classes can be added.
2) The Viewpager class requires a Pageradapter adapter class to provide it with data.
3) Viewpager is often used in conjunction with fragment and offers specialized fragmentpageradapter and Fragmentstatepageradapter classes for fragment use in Viewpager.

Pageradapter, website link: http://developer.android.com/reference/android/support/v4/view/PagerAdapter.html

Pageradapter,android.support.v4.view.pageradapter

Inheriting from Java.lang.object, there are two implementations of subclasses: Fragmentpageradapter, Fragmentstatepageradapter

With Pageradapter, you must implement 4 methods:

Instantiateitem (viewgroup, int)--create the page for the given position.
Destroyitem (viewgroup, int, Object)--remove a page for the given position.
GetCount ()--return the number of views available.
Isviewfromobject (View, Object)--determines whether a page View is associated with a specific key Object as returned by Instantiateitem (ViewGroup, int.)

http://my.oschina.net/summerpxy/blog/210026

Android Development Viewpager and Pageradapter

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.