GeminiYellow
GeminiYellow

Reputation: 1013

How to set ViewPager size

Layout

Could I set the viewpager's size? like the image1, I want to show 3-page in the same screen.

If not, I can only use LinearLayout?

Upvotes: 6

Views: 10982

Answers (2)

Trung Nguyen
Trung Nguyen

Reputation: 7532

Your problem is similar to one CommonWare's blog. Multiple-View ViewPager Options There are three approach. One of those is override getPageWidth() in your PagerAdapter:

@Override public float getPageWidth(int position) { return(0.5f); } 

The others are more complicated but there're attach source and long explanation so i don't copy here.

Upvotes: 20

slezadav
slezadav

Reputation: 6141

To achieve this, you have to create ViewPager with 3 pages, which takes one layout for page 1 and 3 and different one for page 2. In layout for page two define all 2,3,4. In short you have merge pages 2,3,4 into one.

Upvotes: 0

Related Questions