您的位置:首页 > 移动开发 > Android开发

Android获取控件的高度

2015-01-13 11:40 190 查看
public class MeasureUtil {

public static void measure(String tag, View view){

int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);

int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);

view.measure(w, h);

int width = view.getMeasuredWidth();

int height = view.getMeasuredHeight();

Log.d(tag, "width="+width+" / height="+height);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: