Scalio

Carousel Manager

Construction of carousel style layouts

Android LayoutManager 

for RecyclerView to support Carousel view style

Integration with Gradle
implementation 'com.azoft.carousellayoutmanager:carousel:version
Please replace version with the latest version:
 
Description
This LayoutManager works only with fixedSized items in adapter. To use this LayoutManager add gradle (maven) dependence and use this code (you can use CarouselLayoutManager.HORIZONTAL as well):

final CarouselLayoutManager layoutManager = new CarouselLayoutManager(CarouselLayoutManager.VERTICAL);

final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
To enable items center scrolling add this CenterScrollListener:

recyclerView.addOnScrollListener(new CenterScrollListener());
To enable zoom effects that is enabled in gif add this line:

layoutManager.setPostLayoutListener(new CarouselZoomPostLayoutListener());
Full code from this sample:

// vertical and cycle layout
final CarouselLayoutManager layoutManager = new CarouselLayoutManager(CarouselLayoutManager.VERTICAL, true);
layoutManager.setPostLayoutListener(new CarouselZoomPostLayoutListener());

final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(new TestAdapter(this));
recyclerView.addOnScrollListener(new CenterScrollListener());

Customizations
You can enable and disable circular loop using two arguments constructor. Pass true to enable loop and false to disable.

You can make carousel Vertically and Horizontally by changing first argument.


Repository Information

You can view this repository on GitHub here:
https://github.com/Azoft/CarouselLayoutManager

How can we help you?