これが私の問題です。
現在、TicTacToe-Game の相対レイアウトを設定しています。これは、9 つの ImageButton と、グリッドを取得するために使用する 8 つのビューで構成されています。
「リソースが見つかりません」というエラーが xmlfile にある (ID が r.class に正しく組み込まれている場合でも) か、他のビューへのレイアウト参照を再入力するとエラーが消えます。しかし、再入力してプロジェクトをクリーンアップし、再度ビルドすると、Eclipse によって R.class が消えてしまいます。
ここで私のXMLファイル:
`<RelativeLayout 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" >
<View
android:layout_width="5dp"
android:layout_height="160dp"
android:background="#FF0000"
android:layout_toLeftOf="@id/hor2"
android:id="@+id/vert1"
/>
<View
android:layout_width="5dp"
android:layout_height="160dp"
android:background="#FF0000"
android:layout_toLeftOf="@id/hor3"
android:id="@+id/vert2"
/>
<View
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#FF0000"
android:layout_alignLeft="@id/feld4"
android:layout_above="@id/feld4"
android:id="@+id/hor1"
/>
<View
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#FF0000"
android:layout_alignLeft="@id/feld5"
android:layout_above="@id/feld5"
android:id="@+id/hor2"
/>
<View
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#FF0000"
android:layout_alignLeft="@id/feld6"
android:layout_above="@id/feld6"
android:id="@+id/hor3"
/>
<View
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#FF0000"
android:layout_alignLeft="@id/feld4"
android:layout_below="@id/feld4"
android:id="@+id/hor4"
/>
<View
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#FF0000"
android:layout_alignLeft="@id/feld5"
android:layout_below="@id/feld5"
android:id="@+id/hor5"
/>
<View
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#FF0000"
android:layout_alignLeft="@id/feld5"
android:layout_below="@id/feld6"
android:id="@+id/hor6"
/>
<ImageButton
android:id="@+id/feld1"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toLeftOf="@id/vert1"
android:layout_alignTop="@id/vert1"
/>
<ImageButton
android:id="@+id/feld2"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_above="@id/hor2"
android:layout_alignLeft="@id/hor2"
/>
<ImageButton
android:id="@+id/feld3"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toRightOf="@id/vert2"
android:layout_alignTop="@id/vert2"
/>
<ImageButton
android:id="@+id/feld4"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toLeftOf="@id/vert1"
android:layout_alignTop="@id/feld5"
/>
<ImageButton
android:id="@+id/feld5"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_centerInParent="true"
/>
<ImageButton
android:id="@+id/feld6"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toRightOf="@id/vert2"
android:layout_alignTop="@id/feld5"
/>
<ImageButton
android:id="@+id/feld7"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toLeftOf="@id/vert1"
android:layout_below="@id/hor4"
/>
<ImageButton
android:id="@+id/feld8"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toRightOf="@id/vert1"
android:layout_below="@id/hor4"
/>
<ImageButton
android:id="@+id/feld9"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/leer"
android:contentDescription="@string/feld"
android:layout_toRightOf="@id/vert2"
android:layout_below="@id/hor4"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/winners"
android:text="@string/winner"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/anotherGame"
android:visibility="invisible"
android:layout_above="@id/winners"
android:text="@string/newGameButton"
/>
`
誰でも修正方法を考えていますか?
私はすでに通常のものを試しました。xml ファイルの「間違い」を修正し、プロジェクトをクリーンアップし、再度ビルドしました。何も機能しませんでした。