Java 列_布局在android tablelayout中不起作用

Java 列_布局在android tablelayout中不起作用,java,android,Java,Android,android中的表格布局错误。问题是我想使用2 tablerow中的属性列_布局将按钮移动到第二行的1列。我找到了解决办法。请核对我的答案 android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".TableLayoutActivity" android:orientation="vertical" <TableRow> <But

android中的表格布局错误。问题是我想使用2 tablerow中的属性列_布局将按钮移动到第二行的1列。我找到了解决办法。请核对我的答案

android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TableLayoutActivity"
android:orientation="vertical"
      <TableRow>
        <Button android:id="@+id/firstButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/myFirstbtn"/>
        <Button android:id="@+id/ThirdButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/myThirdbtn"/>
        <Button android:id="@+id/FourthButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/myFourthbtn"/>
    </TableRow>
    <TableRow>
            <Button android:id="@+id/secButton"
                android:layout_column="1"
                android:text="@string/mySecbtn"/>
    </TableRow>
android:layout\u width=“match\u parent” android:layout\u height=“match\u parent” 工具:context=“.TableLayoutActivity” android:orientation=“垂直”
我已经删除了权重属性并删除了android:layout\u width=“0dp”。我改为插入android:layout\u width=“wrap\u content”。问题解决了

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".TableLayoutActivity"
    android:orientation="vertical"
   >
<TableRow>
    <Button android:id="@+id/firstButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:text="@string/myFirstbtn"/>

    <Button android:id="@+id/ThirdButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/myThirdbtn"/>
    <Button android:id="@+id/FourthButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/myFourthbtn"/>
</TableRow>
    <TableRow>
        <Button android:id="@+id/secButton"
            android:layout_column="1"
            android:text="@string/mySecbtn"/>
    </TableRow>
</TableLayout>