olistic
olistic

Reputation: 125

Using ViewPager the same way it works in android market (google play)

I have a collection of products from different categories and I want to show the products of each category in different "pages" with the horizontal view swiping functionallity, like in this image.

I tried with the example shown here, but I don't know if I have to use a FragmentPagerAdapter or a simple PagerAdapter. Every page must have the same layout, the unique thing that will change is the source of the data.

How can achieve that? Which could be the best option?

Upvotes: 1

Views: 3939

Answers (2)

LIH
LIH

Reputation: 933

You can use PagerSlidingTabStrip library available on Github https://github.com/astuetz/PagerSlidingTabStriphttps://github.com/astuetz/PagerSlidingTabStrip enter image description here

Upvotes: 0

Ollie C
Ollie C

Reputation: 28509

Use a FragmentPagerAdapter. See a clear example here of how to use it.

http://android-developers.blogspot.co.uk/2011/08/horizontal-view-swiping-with-viewpager.html

Also note there's a free add-on library to indicate which page the user is on

http://www.viewpagerindicator.com

Upvotes: 3

Related Questions