0
我想將紅色複製到所有其餘的正方形,但是當我嘗試這樣做時,出現錯誤「列索引(開始+跨度)不得超過列數」列索引(開始+跨度)不得超過列數
我設置列和行數到3,我的XML代碼是下面。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.zubai.connect3.MainActivity">
<GridLayout
android:id="@+id/gridLayout2"
android:layout_width="match_parent"
android:layout_height="360dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:background="@drawable/board"
android:columnCount="3"
android:rowCount="3"
tools:ignore="UselessParent">
<ImageView
android:id="@+id/imageView"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_column="0"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_row="0"
android:contentDescription=""
android:src="@drawable/red"
tools:ignore="ContentDescription,RtlHardcoded" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_column="0"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_row="0"
android:contentDescription=""
android:src="@drawable/red"
tools:ignore="ContentDescription,RtlHardcoded" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_column="0"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_row="0"
android:contentDescription=""
android:src="@drawable/red"
tools:ignore="ContentDescription,RtlHardcoded" />
</GridLayout>
</RelativeLayout>