码迷,mamicode.com
首页 > 移动开发 > 详细

android安卓onCreate方法中获取控件宽度高度

时间:2016-10-10 16:55:09      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:android   安卓   获取控件宽度   获取控件高度   宽度   高度   

ViewTreeObserver vto = imageView.getViewTreeObserver();   

vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

public void onGlobalLayout() {

imageView.getViewTreeObserver().removeGlobalOnLayoutListener(this); 

int height=imageView.getHeight();

int width =imageView.getWidth();

}

});


android安卓onCreate方法中获取控件宽度高度

标签:android   安卓   获取控件宽度   获取控件高度   宽度   高度   

原文地址:http://11020803.blog.51cto.com/11010803/1860236

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!