的getHeight()和getmeasuredheight之间差() [英] Difference between getheight() and getmeasuredheight()

查看:348
本文介绍了的getHeight()和getmeasuredheight之间差()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要通过这个 http://developer.android.com /guide/topics/ui/declaring-layout.html 当我跨线凸轮指出高度可以,但不必,从测量高度不同,我在想怎么能测量高度是从一个布局高度不同。

I was going through this http://developer.android.com/guide/topics/ui/declaring-layout.html when i cam across a line stating that the height may, but do not have to, be different from the measured height, I was thinking of how can the measured height be different from height of a layout.

推荐答案

方法查看#getMeasuredWidth()查看#getMeasuredHeight()重presents认为想成为的尺寸,之前在布局的所有意见进行计算,并奠定了在屏幕上。

The methods View#getMeasuredWidth() and View#getMeasuredHeight() represents the dimensions the view wants to be, before all views in the layout are calculated and laid in the screen.

查看#onMeasure(INT,INT)查看#onLayout(布尔,INT,INT,INT,INT),观点测量可以改变,以适应一切。这些(可能的)新值,然后通过访问查看#的getWidth()查看#的getHeight()

After View#onMeasure(int, int) and View#onLayout(boolean, int, int, int, int), views measurements could be change to accommodate everything. These (possible) new values are then accessible through View#getWidth() and View#getHeight().

View类参考

的图的大小是pssed的宽度和高度的前$ P $。视图实际拥有2对宽度和高度值。

The size of a view is expressed with a width and a height. A view actually possess two pairs of width and height values.

第一对被称为测量宽度和测量高度。这些尺寸定义视图有多大希望成为其父项内(见布局的更多细节。)测得的尺寸可以通过调用getMeasuredWidth()和getMeasuredHeight()来获得。

The first pair is known as measured width and measured height. These dimensions define how big a view wants to be within its parent (see Layout for more details.) The measured dimensions can be obtained by calling getMeasuredWidth() and getMeasuredHeight().

第二对被简单地称为宽度和高度,或有时拉伸宽度和绘图高度。这些尺寸限定在屏幕视图的实际尺寸,在拉丝时间及布局之后。这些值可以,但不必,是从所测量的宽度和高度不同。的宽度和高度可以通过调用的getWidth()和getHeight()而获得。

The second pair is simply known as width and height, or sometimes drawing width and drawing height. These dimensions define the actual size of the view on screen, at drawing time and after layout. These values may, but do not have to, be different from the measured width and height. The width and height can be obtained by calling getWidth() and getHeight().

这篇关于的getHeight()和getmeasuredheight之间差()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆