-
基本属性
layout_constraintRight_toLeftOf layout_constraintRight_toRightOf layout_constraintTop_toTopOf layout_constraintTop_toBottomOf layout_constraintBottom_toTopOf layout_constraintBottom_toBottomOf layout_constraintBaseline_toBaselineOf
注意baseline是指文字的baseline
match_parent这个属性没有效果。可以用match_constrain来代替
-
控制在父控件中的左右或者上下位置比例
layout_constraintHorizontal_bias //控件的水平偏移比例 layout_constraintVertical_bias //控件的垂直偏移比例
-
固定宽高比例
app:layout_constraintDimensionRatio="16:6" app:layout_constraintDimensionRatio="W,16:6" app:layout_constraintDimensionRatio="H,16:6"
-
线性约束。包括权重和链的种类
app:layout_constraintHorizontal_weight app:layout_constraintHorizontal_chainStyle
weight就和LinearLayout中的用法一样
- chainstyle:spread(默认)、spread_inside、packed
- 可以通过设置weight、bias、width/height来灵活控制显示排列效果
-
GuideLine,不会显示的辅助线
android:orientation // 方向 app:layout_constraintGuide_begin // 距离顶部或左边距离 app:layout_constraintGuide_end // 距离底部或右边的距离 app:layout_constraintGuide_percent // 距离顶部或左边的百分比。0.5/0.8
ConstraintLayout 属性小结
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 想看我更多文章:【张旭童的博客】http://www.jianshu.com/p/9b6e12d8eea0 概述 ...
- app:layout_constraintLeft_toLeftOf //Constrains the left ...
- ConstraintLayout 是在 2016 年 Google 大会上推出的一个新的布局控件,众所周知,Con...
- ConstraintLayout是一种可以灵活的控制view大小和权重的view容器。 支持Android Api...
- 自去年Google I/O 大会发布ConstraintLayout至今,已有一年多的时间,但是并没有普及开来,了...