Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 方法更改传统GridLayout中的位置_Java_Android - Fatal编程技术网

Java 方法更改传统GridLayout中的位置

Java 方法更改传统GridLayout中的位置,java,android,Java,Android,我有一个网格布局,里面有4个按钮。我想更改GridLayout中按钮的位置(例如,从第0行/第0列更改为第1行/第1列)。Java中有没有一种方法可以做到这一点 我已经尝试更改按钮的Id,但没有成功 <android.support.v7.widget.GridLayout android:id="@+id/grdlyt" android:layout_width="395dp" android:layout_height="182dp"

我有一个网格布局,里面有4个按钮。我想更改GridLayout中按钮的位置(例如,从第0行/第0列更改为第1行/第1列)。Java中有没有一种方法可以做到这一点

我已经尝试更改按钮的Id,但没有成功

<android.support.v7.widget.GridLayout
        android:id="@+id/grdlyt"
        android:layout_width="395dp"
        android:layout_height="182dp"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginBottom="8dp"
        android:visibility="gone"
        app:columnCount="2"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:rowCount="2">

        <Button
            android:id="@+id/button_f1_a1"
            android:layout_width="202dp"
            android:layout_height="88dp"
            android:onClick="f1a1Clicked"
            android:text="Affalterbach"
            android:visibility="visible"
            app:layout_column="0"
            app:layout_row="0" />