Android mobile phone development uses linear layout and relative layout to realize the vertical and horizontal center of the button
In the center, there are two different layout methods! LinearLayout and relativelayout, respectively.
1、 The first is the centering under the LinearLayout layout:
Note: Android: Layout_ width="fill_parent" android:layout_ In the height = "fill_parent" attribute, if it is horizontally centered, it will occupy the full screen at least in width; If it is vertically centered, it occupies the full screen in height
2、 Then we talk about the center under the relativelayout layout:
Brief description
Android: gravity = "center_vertical": This is vertically centered
Android: gravity = "bottom": put it at the bottom of the container
Android: gravity = "center": put it in the center of the container
3、 Method of centering two buttons in a row
Method 1:
Method 2: