0

これは私の activity.xml で、エラーが表示されます

No resource found that matches the given name (at 'text' with value '@string/hello_world').

activity.xml のどこにも @string/hello_world がありません

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical" >

    <LinearLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >

        <Button 
            android:id="@+id/press_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/press_button"
        />
    </LinearLayout>

</LinearLayout>

これは私の Strings.xml です

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">GpsLocater</string>
    <string name="action_settings">Settings</string>
    <string name="press_button">Press Button</string>

</resources>

アクティビティを作成すると、hello world が文字列とアクティビティに自動的に配置されますが、削除してしまったので、今回はエラーは何ですか?

4

2 に答える 2

0

プロジェクトの gen ディレクトリにある R.java を削除します。R.java を再作成する必要があります。それでいいはずです。

于 2013-05-21T18:34:46.547 に答える
0

プロジェクトをクリアし、IDE を再起動します。

于 2013-05-21T18:31:59.380 に答える