http://frank-zhu.github.io/android/2015/02/26/android-recyclerview-part-3/
作者的这个文章中给出了ScrollView中嵌套Recycleview使用LinearLayoutManager和GridLayoutManager重写高度的方法,但是没有StaggeredGridLayoutManager的重写高度。
在此补充,已备后用
public class MyStaggeredGridLayoutManager extends StaggeredGridLayoutManager {
public MyStaggeredGridLayoutManager(int spanCount, int orientation, Context mContext) {
super(spanCount, orientation);
mHeightArray = new int[spanCount];
this.mContext = mContext;
for (int i = 0; i < spanCount; i++)
mHeightArray[i] = 0;
}
private int[] mMeasuredDimension = new int[2];
private int[] mHeightArray;
private Context mContext;
@Override
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) {
final int widthMode = View.MeasureSpec.getMode(widt