今天在查看Astrid源码的时候发现了界面布局中Gravity和Visible的新用法,简要记录一下。html
Gravity: API 文档记录android
int | CENTER | Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. |
int | CENTER_HORIZONTAL | Place object in the horizontal center of its container, not changing its size. |
int | CENTER_VERTICAL | Place object in the vertical center of its container, not changing its size. |
这个颇有意思。布局
Constant | Value | Description |
visible | 0 | Visible on screen; the default value.spa |
invisible | 1 | Not displayed, but taken into account during layout (space is left for it). |
gone | 2 | Completely hidden, as if the view had not been added..net |
注意invisible与gone的区别。htm
下面用图演示一下:ip
注意看下面的稍后:ci
1:visible文档
2:invisibleget
“稍后”那个地方空白了
3:gone
这样是否是清楚一点:
visible | invisible | gone |
![]() |
![]() |
![]() |