0

私はstrings.xmlに新しい文字列を作成して保存しました。私のlayout.xmlでそれを使用しようとすると、次のエラーが発生します:

指定された名前に一致するリソースが見つかりません (at'text' with value '@string/breadth')

文字列を使用しようとしているxmlコードは次のとおりです。

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#2F4F4F"
    android:text="@string/breadth"
    android:textAppearance="?android:attr/textAppearanceMedium" />

作成される文字列は次のとおりです。

    <string name="breadth ">Breadth in cms</string>

助けてください

4

2 に答える 2

1

タイプミスがあります。それ以外の:

<string name="breadth ">Breadth in cms</string>

使用する:

<string name="breadth">Breadth in cms</string>

削除されたスペース()に注意してください。

于 2013-02-06T12:23:30.527 に答える
0

name="breadth "以下のように、string.xml ファイルの文字列からスペースを削除します。

<string name="breadth">Breadth in cms</string>
于 2013-02-06T12:49:52.790 に答える