Java 安卓用户界面-在中间对齐按钮,垂直排列

Java 安卓用户界面-在中间对齐按钮,垂直排列,java,android,Java,Android,我试图创建一个界面,上面有一个横幅,但下面的一个表格行有一个垂直排列的按钮列表,但水平排列 到目前为止我的代码是 <?xml version="1.0" encoding="utf-8"?> 所有这一切都是把所有的按钮放在中心,我如何使每个按钮向下流动?我基本上想要一个与您必须使用android:layout\u weight=“1” 在所有按钮上,使其位于中间。 同时将所有的android:gravity和android:layout\u gravity放在“中心

我试图创建一个界面,上面有一个横幅,但下面的一个表格行有一个垂直排列的按钮列表,但水平排列

到目前为止我的代码是

<?xml version="1.0" encoding="utf-8"?>


所有这一切都是把所有的按钮放在中心,我如何使每个按钮向下流动?我基本上想要一个与


您必须使用
android:layout\u weight=“1”
在所有按钮上,使其位于中间。 同时将所有的
android:gravity
android:layout\u gravity
放在“中心” 对于间隔的东西 使用


我认为这一切都应该奏效

嗯,多亏了这一点,垂直对齐是可行的,但是按钮没有在中间对齐,只是在左上角对齐,有什么想法吗?
<Button android:id="@+id/button1" android:layout_height="wrap_content" 
android:layout_width="wrap_content" android:text="Theme">
</Button>

<Button android:id="@+id/button1" android:layout_height="wrap_content" 
android:layout_width="wrap_content" android:text="Theme2">
</Button>

<Button android:id="@+id/button1" android:layout_height="wrap_content" 
android:layout_width="wrap_content" android:text="Theme3">
</Button>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button android:text="Button" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:id="@+id/button1"
        android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></Button>
    <Button android:text="Button" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:id="@+id/button2"
        android:layout_below="@+id/button1" android:layout_centerHorizontal="true"></Button>
    <Button android:text="Button" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:id="@+id/button3"
        android:layout_below="@+id/button2" android:layout_centerHorizontal="true"></Button>
    <Button android:text="Button" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:id="@+id/button4"
        android:layout_below="@+id/button3" android:layout_centerHorizontal="true"></Button>
</RelativeLayout>
padding-left="20dp"
padding-right="20dp"
padding-top="5dp"
paddding-bottom="5dp"