English | 中文
VPLM is a ViewPager
like LayoutManager
which implements some common animations. If you need some other effects feel free to raise an issue or PR.
Each layoutmanager
has bunch of different properties to customize.
Such as:
- radius
- scroll speed
- space
- orientation
Run the demo to see more details.
You can make the target view stop right at center every time you swipe or drag by:
// work exactly same as LinearSnapHelper.
new CenterSnapHelper().attachToRecyclerView(recyclerView);
layoutmanager.setMaxVisibleItemCount(count);
layoutmanager.getCurrentPosition()
Normally you can just use RecyclerView
's SmoothScrollToPosition
method,
but when infinite scroll enabled, using method below to avoid some unexpected errors.
ScrollHelper.smoothScrollToTargetView(recyclerView, itemViewYouWantScrollTo);
You can make it auto play by using AutoPlayRecyclerView
<com.leochuan.AutoPlayRecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:direction="right"
app:timeInterval="1500"/>
Gradle:
repositories {
jcenter()
}
dependencies {
compile 'rouchuan.viewpagerlayoutmanager:viewpagerlayoutmanager:2.x.y'
}
Maven:
<dependency>
<groupId>rouchuan.viewpagerlayoutmanager</groupId>
<artifactId>viewpagerlayoutmanager</artifactId>
<version>2.x.y</version>
<type>pom</type>
</dependency>
Make sure that each item has the same size, or something unpredictable may happen.
You can warm up your layoutmanager by Builder
.
new CircleLayoutManager.Builder(context)
.setAngleInterval(mAngle)
.setMaxRemoveAngle(mMaxRemoveAngle)
.setMinRemoveAngle(mMinRemoveAngle)
.setMoveSpeed(mSpeed)
.setRadius(mRadius)
.setReverseLayout(true)
.build();
Or just simply call the construct.
new CircleLayoutManager(context);
Apache-2.0. See LICENSE file for detail