高度自适应和限高

This commit is contained in:
liujing
2021-09-29 18:39:37 +08:00
parent 93278a0943
commit c4981d9359

View File

@@ -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);
}
}