当前位置:   article > 正文

移动应用开发之约束布局_layout_constrainttop_tobottomof

layout_constrainttop_tobottomof
重点在于找死角区

约束布局在所有布局之中是功能最全,最便捷的布局,可以通过拖拽的方式来实现,由于我总是通过拖拽的方式,导致我看布局文件代码的时候,一脸懵逼,便将约束布局的各个属性整理了下来。

父约束,一般值为parent,也可以是id,加id就成了我下面说的兄弟约束

layout_constraintTop_toTopOf 顶部建立一个约束

layout_constraintBottom_toBottomOf 底部建立一个约束

layout_constraintLeft_toLeftOf 左边建立一个约束

layout_constraintRight_toRightOf 右边建立一个约束

start 含义和left一样,end含义和right有关

layout_constraintStart_toStartOf

layout_constraintEnd_toEndOf

兄弟约束,值为兄弟的id

layout_constraintTop_toBottomOf 顶部和兄弟的底部对齐

layout_constraintBottom_toTopOf 底部和兄弟的顶部对齐

layout_constraintLeft_toRightOf 左边和兄弟右边对齐

layout_constraintRight_toLeftOf 右边和兄弟左边对齐

同样的start含义和left一样,end含义和right一样
layout_constraintStart_toEndOf

layout_constraintEnd_toStartOf

match_constrain即0dp

1.用于控制图片的宽,高之比。将高度或宽度设置成该值,可使用下mai面语句设置宽高值比。
app:layout_constraintDimensionRatio=“n:n”
2.百分比布局:
将宽设置为0dp,再用
app:layout_constraintWidth_percent="小数"来设置宽占整个布局的百分之多少

app:layout_constraintHorizontal_bias和app:layout_constraintVertical_bias

设置偏移,要有相应的水平或垂小数。直方向的约束,值为小数。

暂时只整理了这几个基本的,后面遇到新的知识会加上去的
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/225662
推荐阅读
相关标签
  

闽ICP备14008679号