Need help with CarouselEffect?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

bhaveshjabuvani88
126 Stars 54 Forks 14 Commits 4 Opened issues

Description

Carousel Effect with ViewPager

Services available

!
?

Need anything else?

Contributors list

# 443,621
Java
Kotlin
5 commits

CarouselEffect

Carousel Effect with ViewPager

GifSample

Usage:

Simply add two ViewPager in FrameLayout (1. Top ViewPager for CarouselEffect, 2. Background ViewPager)

Set Top ViewPager padding left and right so previsous and next item display and also set android:clipToPadding="false"

Set Adapter for both ViewPager with same list items

<android.support.v4.view.viewpager android:id="@+id/viewpagerTop" android:layout_width="match_parent" android:layout_height="match_parent" android:cliptopadding="false" android:paddingleft="50dp" android:paddingright="50dp" android:layout_gravity="center"></android.support.v4.view.viewpager>

Parallel scroll both for ViewPagers set OnPageChangeListener to Top ViewPager and override onPageScrolled() and write below logic to

@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
         int width = viewPagerBackground.getWidth();
         viewPagerBackground.scrollTo((int) (width * position + width * positionOffset), 0);
}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.