码迷,mamicode.com
首页 > 移动开发 > 详细

Android 开发 ConstraintLayout详解

时间:2019-01-22 12:23:24      阅读:625      评论:0      收藏:0      [点我收藏+]

标签:分享图片   weight   one   text   str   rri   image   cal   tco   

app:layout_constraintHorizontal_chainStyle

技术分享图片

 

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详解

标签:分享图片   weight   one   text   str   rri   image   cal   tco   

原文地址:https://www.cnblogs.com/guanxinjing/p/10303047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!