android测量的三种模式

测量模式有三种引用官方的解释如下

UNSPECIFIED 
The parent has not imposed any constraint on the child. It can be whatever size it wants.

父View没有对自定义View的大小做任何限制,自定义View想多大就多大,但是不能超过父View的大小

EXACTLY 
The parent has determined an exact size for the child. The child is going to be given those bounds regardless of how big it wants to be.

父View给自定义View确定了一个范围,在这个范围内,自定义view的大小是给出的具体的值,比如 width =100dp,height=200dp,但是如果给出的任何一个数值超过了父View的限制值,他最大是父View的限制值

AT_MOST 
The child can be as large as it wants up to the specified size.

父View没有对自定义控件做任何限制,想多大就多大,可以超过父View的大小,

posted @ 2019-07-23 11:36  野生野鸡码农  阅读(430)  评论(0编辑  收藏  举报