Constraintlayout便查手册

Constraintlayout便查手册

摘取自ConstraintLayout

Relative positioning (相对定位)

[图片上传失败...(image-1013da-1529032552415)]

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_constraintBaseline_toBaselineOf
layout_constraintStart_toEndOf
layout_constraintStart_toStartOf
layout_constraintEnd_toStartOf
layout_constraintEnd_toEndOf

Margins

普通的 margin 依然适用

android:layout_marginStart
android:layout_marginEnd
android:layout_marginLeft
android:layout_marginTop
android:layout_marginRight
android:layout_marginBottom

Margins when connected to a GONE widget

当位置约束目标的可见性为View.GONE时,还可以使用以下属性指示要使用的不同边距值:
layout_goneMarginStart
layout_goneMarginEnd
layout_goneMarginLeft
layout_goneMarginTop
layout_goneMarginRight
layout_goneMarginBottom

Centering positioning and bias(居中定位)


  

app:layout_constraintDimensionRatio

Chains 链

ChainStyle

layout_constraintHorizontal_chainStyle or layout_constraintVertical_chainStyle
When setting the attribute layout_constraintHorizontal_chainStyle or layout_constraintVertical_chainStyle on the first element of a chain, the behavior of the chain will change according to the specified style (default is CHAIN_SPREAD).

  • sprread(default) -- average parent <-> view && view<-> view
  • spread_inside -- average view <-> view , adjoin parent <-> view
  • packed -- average parent <->view , adjoin view <-> view
  • width or height is 0dp -- adjoin 0dp`s view
weight 权重

当 宽高 MATCH_CONSTRAINT(0dp)的时候, 用下面的方法设置权重

layout_constraintHorizontal_weight and layout_constraintVertical_weight

android.support.constraint.Guideline

A Guideline can be either horizontal or vertical

  • specifying a fixed distance from the left or the top of a layout (layout_constraintGuide_begin)(指定布局左侧或顶部的固定距离)
  • specifying a fixed distance from the right or the bottom of a layout (layout_constraintGuide_end)(从布局的右侧或底部指定固定距离)
  • specifying a percentage of the width or the height of a layout (layout_constraintGuide_percent)(指定布局的宽度或高度的百分比)
  • android:orientation 方向

你可能感兴趣的:(Constraintlayout便查手册)