How to have 2 fragment showing at the same time in a viewpager?

I'm trying to do the same thing as in the google play. In movies, when you are on the Home tab and you scroll to the categories tab which is on the left, the categories fragment open only to half of the screen and the other half is still the home tab. How can i implement this using actionbar tabs with a viewpager?

Home tab

Categories tab

Upvotes: 1

Views: 545

Answers (1)

mohamed khalloufi
mohamed khalloufi

Reputation: 467

It's very well explained here: FragmentPagerAdapter Swipe to show ListView 1/3 Screen Width

In PageAdapter :

@Override
public float getPageWidth(int position) {
if (position == 0) {
    return(0.5f);
} else {
    return (1.0f);       
}

Good luck

Upvotes: 2

Related Questions