<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="24sp"
android:text="@string/text1" />
X <Button android:id="@id/button1"
android:layout_width="80sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/red" />
X <Button android:id="@id/button2"
X android:layout_width="80sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
X android:text="@string/green" />
</LinearLayout>
以上是我的xml文件的代码。前面打“X”的是报错的地方。都是同一个错误。报错是类似这样的:
No resource found that matches the given name (at 'text' with value '@string/green').小弟是新手,跪求指导
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="24sp"
android:text="@string/text1" />
X <Button android:id="@id/button1"
android:layout_width="80sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/red" />
X <Button android:id="@id/button2"
X android:layout_width="80sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
X android:text="@string/green" />
</LinearLayout>
以上是我的xml文件的代码。前面打“X”的是报错的地方。都是同一个错误。报错是类似这样的:
No resource found that matches the given name (at 'text' with value '@string/green').小弟是新手,跪求指导
<string name="green"> </string>
<string name="red"> </string>
<string name="red"> </string>
<string name="text1"> </string>
<string name="button1"> </string>
<string name="button2"> </string>
这两句<Button android:id="@id/button2"
<Button android:id="@id/button1"
还是报错:No resource found that matches the given name (at 'id' with value '@id/button1').
<resources>
<item type="id" name="button1"></item>
<item type="id" name="button2"></item>
</resources>