Android UI control-TextView

The function of the program interface is to allow the user to observe and manipulate the data, and to notify the program in response to the user's operation. The controls on the interface are UI elements that display data and respond to user operations, and the controls are the carriers of data and behavior.

TextView

Mainly used to display a piece of text information on the interface.

<TextView
        android:id="@+id/textView"
        android:layout_width="36dp"
        android:layout_height="20dp"
        android:text="你好!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
  • android:id="@+id/textView" means to add a new id called textView, and set the id of the current control to be parent.
  • android:layout_width: The width that the parent layout allows the view to occupy, and width is the width of the view itself.
  • android:layout_height: The height that the parent layout allows the view to occupy, and the height is the height of the view itself.
  • android: text: indicates the text display content
  • layout_constraintTop_toTopOf: align the top of the desired view with the top of another view.

  • layout_constraintTop_toBottomOf: align the top of the desired view with the bottom of another view.

  • layout_constraintBottom_toBottomOf: Align the bottom of the desired view with the bottom of another view.

  • layout_constraintBottom_toTopOf: align the bottom of the desired view with the top of another view.

  • layout_constraintLeft_toTopOf: align the left side of the desired view with the top of another view.

  • layout_constraintLeft_toBottomOf: Align the left side of the desired view with the bottom of another view.

  • 。。。。

If ConstraintLayout does not follow the layout, the constraints of the child controls in the layout cannot be set to "parent", and @+id/parent control id (ConstraintLayout) must be set


 

Guess you like

Origin blog.csdn.net/qq_42141087/article/details/115252681