高度自适应和限高
This commit is contained in:
@@ -33,16 +33,10 @@ public class CheckInfoRecyclerView extends RecyclerView {
|
||||
@Override
|
||||
protected void onMeasure(int widthSpec, int heightSpec) {
|
||||
super.onMeasure(widthSpec, heightSpec);
|
||||
boolean needLimit = false;
|
||||
if (maxHeight >= 0) {
|
||||
needLimit = true;
|
||||
}
|
||||
if (needLimit) {
|
||||
int limitHeight = getMeasuredHeight();
|
||||
if (getMeasuredHeight() > maxHeight) {
|
||||
limitHeight = maxHeight;
|
||||
}
|
||||
setMeasuredDimension(maxWeight, maxHeight);
|
||||
int limitHeight = getMeasuredHeight();
|
||||
if (getMeasuredHeight() > maxHeight) {
|
||||
limitHeight = maxHeight;
|
||||
}
|
||||
setMeasuredDimension(maxWeight, limitHeight);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user