Android 开发 ConstraintLayout详解

app:layout_constraintHorizontal_chainStyle

Android 开发 ConstraintLayout详解

 

app:layout_constraintDimensionRatio

<Button android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintDimensionRatio="H,16:9"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>

app:layout_constraintHorizontal_bias

<ImageView
            android:id="@+id/up_down_image"
            android:src="@mipmap/ic_triangle_black"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintHorizontal_bias="0.55"
            app:layout_constraintTop_toTopOf="@id/select_class"
            app:layout_constraintBottom_toBottomOf="@id/select_class"
            app:layout_constraintLeft_toRightOf="@id/bg"
            app:layout_constraintRight_toLeftOf="@id/bg"/>

 

app:layout_constraintWidth_percent 与 app:layout_constraintHeight_percent

 

<TextView
        android:id="@+id/text_noon"
        android:text="demo"
        android:textSize="@dimen/font_size_14"
        android:textColor="@color/fontBlack3"
        android:background="@color/colorGreen"
        android:gravity="center"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginTop="15dp"
        android:layout_marginBottom="15dp"
        app:layout_constraintHorizontal_bias="0.90"
        app:layout_constraintWidth_percent="0.20"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"/>

 

app:layout_constrainedWidth

 

 

 

 

constraintlayout.widget.Barrier

 

<androidx.constraintlayout.widget.Barrier
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:barrierDirection="left"
            app:constraint_referenced_ids="up_down_image"
            app:layout_constraintTop_toTopOf="@id/bg"
            app:layout_constraintBottom_toBottomOf="@id/bg"
            app:layout_constraintRight_toLeftOf="@id/up_down_image"/>

 constraintlayout.widget.Guideline

<androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.04"/>

constraintlayout.widget.Group

<androidx.constraintlayout.widget.Group
        android:id="@+id/group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:constraint_referenced_ids="line,whether,opinion"
        app:layout_constraintTop_toBottomOf="@id/name"
        app:layout_constraintLeft_toLeftOf="parent"/>

Space

<Space
        android:layout_width="0dp"
        android:layout_height="20dp"
        app:layout_constraintTop_toBottomOf="@id/opinion"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"/>

 

Android 开发 ConstraintLayout详解

上一篇:拷贝和移动


下一篇:android仿网易云音乐引导页、仿书旗小说Flutter版、ViewPager切换、爆炸菜单、风扇叶片效果等源码