如何得到xml中控件的宽高

前端之家收集整理的这篇文章主要介绍了如何得到xml中控件的宽高前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。



int w = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
int h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
listView.measure(w,h);
int height = listView.getMeasuredHeight();
Log.e("ee","page1中listview的高:" + height);
原文链接:https://www.f2er.com/xml/296890.html

猜你在找的XML相关文章