package com.moral.andbrickslib.views;
|
|
import android.content.Context;
|
import android.support.annotation.Nullable;
|
import android.support.v7.widget.RecyclerView;
|
import android.util.AttributeSet;
|
import android.view.ViewGroup;
|
|
/**
|
* author 姚智胜
|
* version V1.0
|
* Description: 在ScrollView中的RecyclerView 与RecyclerForScrollView同时使用
|
* date 2016/11/21 23:38
|
*/
|
|
public class RecyclerViewForScrollView extends RecyclerView {
|
public RecyclerViewForScrollView(Context context) {
|
super(context);
|
}
|
|
public RecyclerViewForScrollView(Context context, @Nullable AttributeSet attrs) {
|
super(context, attrs);
|
}
|
|
public RecyclerViewForScrollView(Context context, @Nullable AttributeSet attrs, int defStyle) {
|
super(context, attrs, defStyle);
|
}
|
|
@Override
|
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
super.onMeasure(widthMeasureSpec, expandSpec);
|
|
ViewGroup.LayoutParams params = getLayoutParams();
|
params.height = getMeasuredHeight();
|
|
setNestedScrollingEnabled(false);
|
|
}
|
}
|