Android 最保险的获取控件的高度
作者:
__素颜__ | 来源:发表于
2019-06-28 16:57 被阅读0次 flowlayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
flowlayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
ViewGroup.LayoutParams layoutParams = scrollview.getLayoutParams();
scrollview.setLayoutParams(layoutParams);
layoutParams.height = flowlayout.getMeasuredHeight();
scrollview.setLayoutParams(layoutParams);
}
});
本文标题:Android 最保险的获取控件的高度
本文链接:https://www.haomeiwen.com/subject/qbrecctx.html
网友评论