ConstraintLayout使用的方方面面
-
-
- 一、基本属性app:layout_constraintLeft_toLeftOf(对齐约束)等
- 二、app:layout_constraintHorizontal_bias(偏移量比)等
- 三、app:layout_constraintDimensionRatio(宽高比)
- 四、app:layout_constraintHorizontal_weight(类似LinearLayout的weight属性)
- 五、app:layout_constraintVertical_chainStyle(对齐方式)
- 六、Guideline(辅助线)
- 七、 app:layout_constraintWidth_percent(宽高百分比)
- 八、android.support.constraint.Group(群组)
- 九、ConstraintLayout在ScrollView中使用
- 十、总结
-
ConstraintLayout布局从中文意思理解即为约束布局。本篇博客不做其他解释,主要讲解ConstraintLayout的使用,因为自己目前在实际项目中使用的比较多,所以感觉对其的使用还是有了一定的了解,也看过一些文章,在实际使用中这个布局也确实很好用。之前也看过郭神和鸿洋大神的关于ConstraintLayout使用的文章,看的郭神的讲的主要是可视化操作,直接进行拖拽,鸿神的是在xml布局中手动敲代码布局实现。两篇文章都写的非常好,大家也可以搜搜看下。但是我个人的一个操作是直接在xml布局中代码编写布局,这样感觉更容易控制。好了,废话了这么多,接下来也该开始进入正题了。
一、基本属性app:layout_constraintLeft_toLeftOf(对齐约束)等
app:layout_constraintLeft_toLeftOfapp:layout_constraintTop_toTopOfapp:layout_constraintBottom_toBottomOfapp:layout_constraintRight_toRightOf
依此类推,我们可以知道还会有如下等一系列基本属性
app:layout_constraintLeft_toRightOf
app:layout_constraint
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
