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
相關文章
相關標籤/搜索