Chr*_*ris 24 android android-constraintlayout
我对 Android 开发相当陌生,今天我想知道“ConstraintLayout”中的“垂直偏差”和“水平偏差”分别有何用途。
Mił*_*osz 34
简而言之 - 它告诉布局如何在受约束的视图之间放置视图。如果您的 ConstraintLayout 内的视图有这些:
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Run Code Online (Sandbox Code Playgroud)
默认情况下它将放置在中间。
但你可以添加:
app:layout_constraintHorizontal_bias="1" to place it at the end of the constraint (parent in this example)
app:layout_constraintHorizontal_bias="0" to place it at the beginning of the constraint (parent in this example)
app:layout_constraintHorizontal_bias="0.33" to place it on/third of the space from the begining of the constraint (parent in this example)
Run Code Online (Sandbox Code Playgroud)
ETC。
垂直偏置在垂直方向上也有同样的作用。
| 归档时间: |
|
| 查看次数: |
21715 次 |
| 最近记录: |