LuxuryMode
LuxuryMode

Reputation: 33741

Setting TextView to new string?

I used the layout resource editor to modify the main.xml layout file to add a second TextView control to my app. by default, its set to something like @+id/TextView01. How do I Set the text attribute of the TextView control to my newly created String resource? I tried going into main.xml and just editing the android:text to point to the name of my new string, but it didn't seem to work.

Upvotes: 0

Views: 331

Answers (1)

Mads Lee Jensen
Mads Lee Jensen

Reputation: 4648

you define your strings inside resources/strings/values.xml and you can reference them using "@string/name_of_string" syntax in your layouts.

android:text="@string/name_of_string"

Upvotes: 1

Related Questions