So, what you have to do to align center
(horizontally and vertically which means middle of whole screen).
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
alternatively,
android:layout_centerInParent="true"
This way you can put buttons on center. Suppose, you put a button(called A
) on center. Now, you wanna put another button beside that button. Than you have to write
android:layout_toRightOf="@+id/A"
above code in button B
. If you want to put another button on left of button A
. Then, try
android:layout_toLeftOf="@+id/A"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…