FlowLayoutManager
FlowLayoutManager copied to clipboard
Android 3rd party library to make implementing a FlowLayoutManager
FlowLayoutManager
Android 3rd party library to make implementing a FlowLayoutManager
FlowLayoutManager is a layoutManager that works with Android RecyclerView Widget, to layout views in flow style, with support of predictive animations, item per line limit, auto measurement & alignments (left or right)
Screenshots

Installation
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.simonebortolin:FlowLayoutManager:1.8.0'
}
Item per line limitation
Single item per line
recyclerView.setLayoutManager(new FlowLayoutManager().singleItemPerLine());
recyclerView.setLayoutManager(FlowLayoutManager().singleItemPerLine())
or x items per line
recyclerView.setLayoutManager(new FlowLayoutManager().maxItemsPerLine(x));
recyclerView.setLayoutManager(FlowLayoutManager().maxItemsPerLine(x))
to remove Item per line limitation
((FlowLayoutManager)recyclerView.getLayoutManager()).removeItemPerLineLimit();
(recyclerView.getLayoutManager() as FlowLayoutManager).removeItemPerLineLimit()
Auto measurement
FlowLayoutManager flowLayoutManager = new FlowLayoutManager();
flowLayoutManager.setAutoMeasureEnabled(true);
recyclerView.setLayoutManager(flowLayoutManager);
flowLayoutManager = FlowLayoutManager()
flowLayoutManager.setAutoMeasureEnabled(true)
recyclerView.setLayoutManager(flowLayoutManager)
Alignment
recyclerView.setLayoutManager(new FlowLayoutManager().setAlignment(Alignment.LEFT));
recyclerView.setLayoutManager(FlowLayoutManager().setAlignment(Alignment.LEFT))
Alignment could be LEFT, CENTER or RIGHT.
Credits
I thank all the authors of the various commits that I have included in my fork
License
Copyright (c) 2016 xiaofeng-han
Licensed under the GNU GENERAL PUBLIC LICENSE (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://github.com/simonebortolin/FlowLayoutManager/blob/master/LICENSE
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.