Gravity 与 Visiable

今天在查看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.

 

android:visibility:API文档记录

这个颇有意思。布局

 

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文档

screenshot5073051950355435362

2:invisibleget

screenshot546373699998269721 

“稍后”那个地方空白了

3:gone

screenshot7768801419029524269

这样是否是清楚一点:

visible invisible gone
screenshot5073051950355435362 screenshot546373699998269721  screenshot7768801419029524269
相关文章
相关标签/搜索