Before also wrote a ViewGroup version of the streaming layout, the streaming layout has two big advantages: can set the number of lines and whether the content in the row center display (strong timestamp), really since the RecyclerView LayoutManager has a new understanding, completely do not have to worry about a lot of complex layout. And don’t worry about the ViewGroup measurement process, because there is LayoutManager to help us implement. Let’s get to the main point of the article. Without further ado, the picture above is more convincing.
In the example above, I used a TextView and an ImageView for an ItemView. In fact, there is nothing to say, mainly how to define such a LayoutManager. We believe that you have used the LinearLayoutManager. The LayoutManager provided by the system is typesetted in an aligned way. Our flow style here is to judge whether the extra space in the line is enough to display before typesetting the item.
Use:
As shown in theTextFlowActivity,DiffHeightTextFlowActivity,PhotoFlowActivity
RecyclerView recyclerView = (RecyclerView) findViewById(flow); FlowLayoutManager flowLayoutManager = new FlowLayoutManager(); / / set each item spacing recyclerView addItemDecoration (new SpaceItemDecoration (dp2px (10))); recyclerView.setLayoutManager(flowLayoutManager); recyclerView.setAdapter(new FlowAdapter());Copy the code
Common commodity attribute interface (RV nested RV,item height wrAP_content):
Use: See ProductActivity
Common suspended goods attribute interface (RV nested RV,item height wrAP_content):
Use: see SuspensionProductActivity
Animation fixes:
Use: See TextFlowActivity
Viewpager streaming layout application:
Use: See ViewPagerActivity
Add RV nested RV height for WRAP_content does not show problem, please use: NestedRecyclerView
Add long click to enter delete effect, click outside to enter normal mode: See you use:LongClickDeleteTextFlowActivity
Gradle depends on:
all projects { repositories { ... Dependencies maven {url 'https://jitpack.io'}}} {the compile 'com. Making. 1002326270 xc: LayoutManager - FlowLayout: v1.6'}Copy the code
You are welcome to ask questions, message board or email directly contact me. I will test relevant bugs as soon as possible
Welcome guests to our shop :184793647(QQ group)
About me:
email: [email protected]
csdn:enter
github:enter