[Android studio] Section 15 ConstraintLayout control

ConstraintLayout is a layout container in Android. It is a flexible and powerful layout tool for creating complex interface layouts. It uses constraints to define the relationships and alignment between subviews.

The following are commonly used properties of ConstraintLayout:

  1. app:layout_constraintTop_toTopOf: Aligns the top of the subview with the top of the specified view.
  2. app:layout_constraintBottom_toBottomOf: Aligns the bottom of the subview with the bottom of the specified view.
  3. app:layout_constraintStart_toStartOf: Aligns the start end of the subview with the start end of the specified view.
  4. app:layout_constraintEnd_toEndOf: Aligns the end of the subview to the end of the specified view.
  5. app:layout_constraintLeft_toLeftOf: Aligns the left side of the subview with the left side of the specified view.
  6. app:layout_constraintRight_toRightOf: Aligns the right side of the subview to the right side of the specified view.
  7. app:layout_constraintTop_toBottomOf: Aligns the top of the subview with the bottom of the specified view.
  8. app:layout_constraintBottom_toTopOf: Aligns the bottom of the subview with the top of the specified view.
  9. app:layout_constraintStart_toEndOf: Aligns the start end of the subview with the end end of the specified view.
  10. app:layout_constraintEnd_toStartOf: Aligns the end of the subview with the start of the specified view.
  11. app:layout_constraintHorizontal_bias: Set the offset value of the subview in the horizontal direction.
  12. app:layout_constraintVertical_bias: Set the offset value of the subview in the vertical direction.
  13. app:layout_constraintWidth_percent: Sets the width of the subview as a percentage of the width of the parent view.
  14. app:layout_constraintHeight_percent: Set the height of the subview as a percentage of the height of the parent view.
  15. app:layout_constraintDimensionRatio: Set the aspect ratio of the subview.
  16. app:layout_constraintHorizontal_chainStyle: Set the chain style when multiple subviews are arranged horizontally.
  17. app:layout_constraintVertical_chainStyle: Set the chain style when multiple subviews are arranged vertically.
  18. app:layout_constraintGuide_percent: Creates a guideline with a specified percentage position.
  19. app:layout_constraintBaseline_toBaselineOf: Aligns the subview's baseline with the specified view's baseline.
  20. app:layout_constraintCircle: Places subviews on the circle of the specified view.

These properties can be set on the subviews of ConstraintLayout to define the relationship and alignment between them, thereby creating flexible and responsive interface layouts. You can select the appropriate properties to configure according to your needs.

Guess you like

Origin blog.csdn.net/AA2534193348/article/details/131476931