Demonstrate ViewPager and viewpager

Source: Internet
Author: User

Demonstrate ViewPager and viewpager
Content

  • Environment
  • Project Structure
  • Demonstration 1: PagerTitleStrip
  • Demonstration 2: PagerTabStrip
  • Demonstration 3: ViewPager and dynamic Fragment
Download Demo Environment
  • Windows 2008 R2 64-bit
  • Eclipse ADT V22.6.2, Android 4.4.2 (API 19)
  • SAMSUNG GT-8618, Android OS 4.1.2
Project Structure

Figure 1 Project Structure

Figure 2 main project Interface 

Demonstration 1: PagerTitleStrip

Figure 3 shows PagerTitleStrip and click "Weibo"

Demonstration 2: PagerTabStrip

Figure 4 PagerTabStrip

 

In the official document, PagerTabStrip and PagerTitleStrip are described as "PagerTabStrip is an interactive indicator of the current, next, and previous pages ofViewPager. "And" PagerTitleStrip is a non-interactive indicator of the current, next, and previous pages ofViewPager."

To put it simply, PagerTabStrip and PagerTitleStrip can both implement slide switching to the Tab page, but PagerTabStrip also implements switching to the Tab page by clicking the Tab, while PagerTitleStrip cannot.

Demonstration 3: ViewPager and dynamic Fragment

Figure 5 ViewPager and dynamic Fragment

 

The difference between FragmentStatePagerAdapter and FragmentPagerAdapter is that FragmentStatePagerAdapter only exists in the previous Fragment, and other Fragment will be destroyed, which is suitable for loading multiple data. FragmentPagerAdapter is applicable to all Fragment, therefore, it is not suitable for loading a large number of data slices or something, and it is easy to cause memory overflow.

 

Download Demo

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.