ConstraintLayout簡要說明書

2021-10-04 19:22:28 字數 2542 閱讀 2530

1.新增依賴

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

2.相對定位常用屬性:(layout_相對於當前控制項的位置_相對於依賴控制項的位置)

layout_constraintleft_toleftof layout_constraintleft_torightof layout_constraintright_toleftof layout_constraintright_torightof layout_constrainttop_totopof layout_constrainttop_tobottomof layout_constraintbottom_totopof layout_constraintbottom_tobottomof layout_constraintstart_toendof layout_constraintstart_tostartof layout_constraintend_tostartof layout_constraintend_toendof 

layout_constraintbaseline_tobaselineof 

baseline指的是文字基線

3.角度定位指的是textview2的中心在textview1的中心的120度,距離為150dp

4.邊距

4.1 常用margin

與其他布局的差別:必須先約束該控制項在constraintlayout裡的位置

textview1沒有約束在constraintlayout裡的位置,所以是不生效的。textview2生效

並且margin只能大於或等於0

4.2 gonemargin

gonemargin主要用於約束的控制項可見性被設定為gone的時候使用的margin值。

屬性如下: layout_gonemarginstart layout_gonemarginend layout_gonemarginleft layout_gonemargintop layout_gonemarginright layout_gonemarginbottom

在textview1隱藏的時候,textview2會有乙個10dp的左邊距出現。

4.3 居中和偏移

居中:

偏移:layout_constrainthorizontal_bias 水平偏移

layout_constraintvertical_bias 垂直偏移

4.4 尺寸約束

方式一:指定尺寸

方式二:使用wrap_content

可以控制最大最小的寬度高度

設定0dp配合約束代替match_parent

寬高比設定:

4.5 鏈兩個或兩個以上的控制項約束一起

一條鏈的第乙個控制項是這條鏈的鏈頭,通過設定鏈頭的layout_constrainthorizontal_chainstyle來改變樣式

chain_spread —— 展開元素 (預設);

chain_spread_inside —— 展開元素,但鏈的兩端貼近parent;

chain_packed —— 鏈的元素將被打包在一起

權重:layout_constrainthorizontal_weight(constraintvertical為縱向)

在多個控制項的一側建立乙個屏障

6. group把多個控制項設為一組,方便隱藏或顯示一組控制項

android:id="@+id/textview2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:id="@+id/textview3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:id="@+id/group"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:visibility="invisible"

BCP簡要說明

bcp是sybase公司提供專門用於資料庫表一級資料備份的工具。一般存放在所安裝的ase或者open client 的bin目錄中。12版本以前的ase,bcp存放目錄為 sybase bin 12版本 含12版本 以後存放目錄為 sybase ocs 12 x bin 其中 sybase為syba...

initcall debug簡要說明

linux version 3.10.40 1.使用說明 documentation kernel parameters.txt中的說明如下 initcall debug knl trace initcalls as they are executed.useful for working out ...

ramoops pstore簡要說明

1.pstore pstore是persistent storage的縮寫。核心發生異常時如果能將日誌等資訊儲存下來不丟失,那麼就可以通過這些資訊來定位問題。不同的平台可以提供的儲存位置不同,例如有些平台支援硬碟,有些不支援。除了平台差異,異常型別也決定了在發生異常時該儲存位置是否還可用。pstor...