Ich bereite ein Tic-Tac-Spiel vor: Zunächst sind alle 9 Zellen leer. Beim Start Spiel, wie ich Nummer eingeben, ändert sich die Breite der Zelle dynamisch.Wie das zu verhindern?Wie make TextViews eine Zeilenbreite füllen?
Meine xml codeof 9 Zellen:
<GridLayout
android:id="@+id/grid_layout_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="20dp"
android:background="@android:color/holo_red_dark"
android:rowCount="3"
android:columnCount="3"
android:padding="10dp"
android:theme="@style/MyTextViewStyle">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="1" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="2" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="4" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="5" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="7" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="8" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
tools:text="" />
</GridLayout>
PS: Ich möchte nicht, Tabellen-Layout, Satz von Horizontale und vertikale Linear Layouts oder andere Ansichten verwenden. Bitte sagen Sie mir, wie Sie es in GridLayout selbst tun.