ViewportWidth,Width,MeasuredWidth

1, ViewportWidth是vector图片的画布,相当于vector内容外面的盒子。如果ViewportWidth跟vector里面的width不一致,ViewportWidth也会影响最终的显示尺寸。如果当imageView的width,假设为widthM小于ViewportWidth, vector的内容会被scale,相当于width * (widthM/ViewportWidth).
2, MeasuredWidth 是本身的尺寸,layout的里面的width才是最终显示的尺寸。比如下面的代码:

ic_ball.xml



ImageView的meansure尺寸,永远等于24dp,无论如何改变layout_width的大小,因为layout_width是layout的约束,不是view自身的大小。

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

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().

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().

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值