I am quite new to Android development and today I wondered what the 'Vertical Bias' respectively the 'Horizontal Bias' is used for in the 'ConstraintLayout'.
In short - it tells the layout how to place a view between the constrained views. If Your view inside ConstraintLayout has these:
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
it will be placed in the middle by default.
But You can add:
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)
etc.
Vertical bias does the same vertically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With