StupidBeauty
Read times:859Posted at:Thu Aug 22 03:25:16 2013
- no title specified

转载:【Android】Android 获取控件高度宽度三种方法

只需调用View.getWidth()便可获取某个控件当前的宽度值,其单位为像素点。

http://www.apkbus.com/blog-38897-44074.html

亮点:

//-----------------------------------------------方法三
ViewTreeObserver vto2 = imageView.getViewTreeObserver();
vto2.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
imageView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
textView.append("\n\n"+imageView.getHeight()+","+imageView.getWidth());
}
});

地球正在数字化

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands