
Alekto
Neues Mitglied
- 1
Hallo liebe Community!
Ich studiere Medieninformatik und hab gerade eine Vorlesung zur Android-Programmierung. Wir müssen Tic Tac Toe bauen, am Ende soll es so aussehen.
Mein Problem ist jetzt, dass ich die 9 Kästchen mithilfe eines TableLayouts "gezeichnet" hab; jetzt wollte ich sie mit einem ArrayAdapter verbinden, damit ich über den zweidimensionalen Array auch auf die 9 Kästchen zugreifen kann. Nur sagt mir Google gerade, dass man einen ArrayAdapter nur mit Listviews und dergleichen verknüpfen kann.. ich weiß nun leider gar nicht, wie ich sonst an das Problem herangehen soll. Hat jemand von euch einen Tipp? Wäre wirklich für jede Hilfe dankbar.
Falls es interessiert, ist hier der Code von meinem Layout.
Ich studiere Medieninformatik und hab gerade eine Vorlesung zur Android-Programmierung. Wir müssen Tic Tac Toe bauen, am Ende soll es so aussehen.
Mein Problem ist jetzt, dass ich die 9 Kästchen mithilfe eines TableLayouts "gezeichnet" hab; jetzt wollte ich sie mit einem ArrayAdapter verbinden, damit ich über den zweidimensionalen Array auch auf die 9 Kästchen zugreifen kann. Nur sagt mir Google gerade, dass man einen ArrayAdapter nur mit Listviews und dergleichen verknüpfen kann.. ich weiß nun leider gar nicht, wie ich sonst an das Problem herangehen soll. Hat jemand von euch einen Tipp? Wäre wirklich für jede Hilfe dankbar.
Falls es interessiert, ist hier der Code von meinem Layout.
Code:
<LinearLayout 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"
android:background="@drawable/notepad2"
android:orientation="vertical" >
<TextView
android:id="@+id/playerOneWithName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:layout_marginTop="20sp"
android:textSize="18sp" />
<TextView
android:id="@+id/playerTwoWithName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:textSize="18sp" />
<TextView
android:id="@+id/winnerOrRemis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:layout_marginTop="20sp"
android:gravity="center"
android:textSize="20sp" />
<TableLayout
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="240dp"
android:layout_marginLeft="20sp"
android:layout_marginRight="20sp"
android:layout_marginTop="25sp" >
<TableRow
android:id="@+id/tableRow0"
android:layout_width="fill_parent"
android:layout_height="80dp" >
<TextView
android:id="@+id/row0_0"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/player_Two"
android:textSize="20sp" />
<View
android:layout_width="3dip"
android:layout_height="fill_parent"
android:background="@color/black" />
<TextView
android:id="@+id/row0_1"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/app_name"
android:textSize="20sp" />
<View
android:layout_width="3dip"
android:layout_height="fill_parent"
android:background="@color/black" />
<TextView
android:id="@+id/row0_2"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/button_Text"
android:textSize="20sp" />
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:background="@color/black" />
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="80dp" >
<TextView
android:id="@+id/row1_0"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/player_Two"
android:textSize="20sp" />
<View
android:layout_width="3dip"
android:layout_height="fill_parent"
android:background="@color/black" />
<TextView
android:id="@+id/row1_1"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/button_Text"
android:textSize="20sp" />
<View
android:layout_width="3dip"
android:layout_height="fill_parent"
android:background="@color/black" />
<TextView
android:id="@+id/row1_2"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/header_Text"
android:textSize="20sp" />
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:background="@color/black" />
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="80dp" >
<TextView
android:id="@+id/row2_0"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/player_Two"
android:textSize="20sp" />
<View
android:layout_width="3dip"
android:layout_height="fill_parent"
android:background="@color/black" />
<TextView
android:id="@+id/row2_1"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/player_Two"
android:textSize="20sp" />
<View
android:layout_width="3dip"
android:layout_height="fill_parent"
android:background="@color/black" />
<TextView
android:id="@+id/row2_2"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="@string/player_Two"
android:textSize="20sp" />
</TableRow>
</TableLayout>
</LinearLayout>