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

时间:2016-10-10 16:52:15   收藏:0   阅读:267

ViewTreeObserver vto = imageView.getViewTreeObserver();   

vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

public void onGlobalLayout() {

imageView.getViewTreeObserver().removeGlobalOnLayoutListener(this); 

int height=imageView.getHeight();

int width =imageView.getWidth();

}

});


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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!