How to use common controls in android:

TextView

The simplest control for TextView.
android:id defines a unique identifier for the current control
android:layout_width and android:layout_height specify the width and height of the control.
All spaces in android have these two attributes, and there are 3 optional values:
match_parent, fill_parent and wrap_content.
Where match_parent means to make the size of the current control the same as the size of the parent layout.
Wrap_content means that the size of the current control can just contain the content inside, that is, the size of the current control is determined by the content of the control.
We use android:gravity to specify the alignment of the text. The optional values ​​are top, bootom, left, right, center Wait. You can use "|" to specify multiple values ​​at the same time. Here we specify the center, the effect is equivalent to center_vertical|center_horizontal, which means that the text is aligned in the center in both the vertical and horizontal directions.

Specify the color and size of the text

The android:textSize attribute can specify the size of the text.
The color of the text can be specified through the android:textColor attribute. In Android, the font size uses sp as the unit.

Button

Button is an important control used by the program to interact with the user.

EditText

EditText is another important control used by the program to interact with the user. It allows the user to input and edit content in the control, and can process the content in the program.

ImageView

ImageView is a control for displaying pictures on the interface, it can make our program interface more colorful.

Guess you like

Origin blog.csdn.net/i_nclude/article/details/75091215