Peter
Peter

Reputation: 3

XMl layout file does not recognising string created in strings.xml

I have created new string in strings.xml and saved it. When i am trying to use it in my layout.xml i get this error:

no resource found that matches the given name (at'text' with value '@string/breadth')

the xml code where i am trying to use the strin is:

<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" />

the string created is:

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

please help

Upvotes: 0

Views: 105

Answers (2)

GrIsHu
GrIsHu

Reputation: 23638

Remove the space from your string name="breadth " in your string.xml file as below:

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

Upvotes: 0

andr
andr

Reputation: 16064

You have a typo. Instead of:

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

use:

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

Note the removed space ().

Upvotes: 1

Related Questions