美文网首页
View的几种计算模式

View的几种计算模式

作者: 坠叶飘香 | 来源:发表于2019-05-09 11:56 被阅读0次

1.父view未对子view的大小做限制,子view需要多大,就给多大

随便

/**
  * Measure specification mode: The parent has not imposed any constraint
  * on the child. It can be whatever size it wants.
*/
public static final int UNSPECIFIED = 0 << MODE_SHIFT;

2.父view指定了子view的大小

等于

/**
  * Measure specification mode: 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.
*/
public static final int EXACTLY     = 1 << MODE_SHIFT;

3.父view指定了子view的最大大小

小于等于

/**
  * Measure specification mode: The child can be as large as it wants up
   * to the specified size.
*/
public static final int AT_MOST     = 2 << MODE_SHIFT;

相关文章

网友评论

      本文标题:View的几种计算模式

      本文链接:https://www.haomeiwen.com/subject/kaxwoqtx.html