A RecyclerView.LayoutManager implementation which provides functionality to show a group of stack view.
Android library that provides A RecyclerView.LayoutManager implementation which provides functionality to show a group of stack view.
StackLayoutManager provides the following advantages:
If you're using Gradle, you can declare this library as a dependency:
dependencies { implementation 'com.littlemango:stacklayoutmanager:1.0.5' }
The simplest way to use StackLayoutManager is by dropping the library JAR file into your project creating the StackLayoutManager object and pass it back to the RecyclerView object:
StackLayoutManager manager = new StackLayoutManager();recyclerView.setLayoutManager(manager);
//orientation can be one of ScrollOrientation.BOTTOM_TO_TOP or TOP_TO_BOTTOM or RIGHT_TO_LEFT or LEFT_TO_RIGHT ScrollOrientation orientation = ScrollOrientation.BOTTOM_TO_TOPStackLayoutManager manager = new StackLayoutManager(orientation);
recyclerView.setLayoutManager(manager);
//or in setter method manager.setVisibleItemCount(3); ```
manager.setItemOffset(50);
//scroll to position immediately without animation recyclerView.scrollToPosition(3);
5. You can set the view to turn only one page at a time, like a ViewPager, or you can turn pages continuously:java manager.setPagerMode(true or false); ```
When in PagerView paging mode, you can set the minimum sliding velocity that triggers the paging effect:
java manager.setPagerFlingVelocity(3000);
You can add a item changed Listener to StackLayoutManager:
mStackLayoutManager.setItemChangedListener(new StackLayoutManager.ItemChangedListener() { @Override public void onItemChanged(int position) { mToast.setText("first visible item position is " + position); mToast.show(); } });
I use the DefaultAnimation class to provide animation, which is inherited from StackAnimation, and you can inherit both classes to achieve the desired animation effect:
java DefaultAnimation animation = new DefaultAnimation(ScrollOrientation.BOTTOM_TO_TOP, visibleCount); manager.setAnimation(animation);
I use the DefaultLayout class to implement the layout of items, which inherits from StackLayout. You can inherit both classes to achieve the layout effect you want:
java StackLayoutManager manager = new StackLayoutManager(ScrollOrientation.BOTTOM_TO_TOP, visibleCount, DefaultAnimation.class, DefaultLayout.class);
You can clone or download this project to your computer and install sample apk on your phone to see the effect.
Or you can scan QR code to install the apk:
MIT License See MIT License