java - Android 实现recyclerview嵌套瀑布流的效果 类似足记广场方案
大家讲道理
大家讲道理 2017-04-18 09:15:57
0
2
428

最进产品有个需求 需要做一个类似于足记广场一样的界面布局

在开发过程中发现 底部的瀑布流可以通过recyclerview实现
或者使用第三方AndroidStaggeredGrid
https://github.com/etsy/AndroidStaggeredGrid
但是外部已经是一个recyclerview 嵌套的时候发现有无法显示以及触控问题

之后我反编译了它的app发现这个布局是通过一个线性布局嵌套两个
frameLayout 但是具体还是摸不清个所以然

所以我想问下各位有什么好的方案 或者 是开发建议

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
小葫芦

This problem has been temporarily solved
The solution is as follows:
1. Set the layout scheme of recyclerview to StaggeredGridLayout waterfall flow layout

StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(layoutManager);

2. For layouts that require a single line at the top, set Span to a single line by the following method

private void setFullColum(RecyclerView.ViewHolder viewHolder) {
        StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams)
                viewHolder.itemView.getLayoutParams();
        layoutParams.setFullSpan(true);
    }
左手右手慢动作

The main body is written in recycle. Then make a listview that displays all the information and put it at the head of the recycleview

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template