int width = getWidth();
int disWidth = 18;
int row =0;
for (int i=0;i<getChildCount();i++){
View view = getChildAt(i);
int measuredHeight = view.getMeasuredHeight();
int measuredWidth = view.getMeasuredWidth();
if(disWidth+row*measuredHeight>width){
row++;
disWidth=18;
}
view.layout(disWidth,row*measuredHeight,measuredWidth+width,measuredHeight*(row+1));
disWidth+=measuredWidth;
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
measureChildren(widthMeasureSpec,heightMeasureSpec);
}
流失
最新推荐文章于 2019-08-09 11:15:37 发布