I am developing two languages program, so I am trying to set
some text from res/values-en/strings.xml
but I don't have any idea how to do it
from here
<string name="advices">Advices</string>
to here
<TextView
android:text="TO HERE <---------"
android:textColor="#999999"
android:textStyle="bold"
android:textSize="12sp" />
A string resource provides text strings for your application with optional text styling and formatting. There are three types of resources that can provide your application with strings: String. XML resource that provides a single string.
The reference to entity "Drop" must end with the ';' delimiter. How can I write character & in the strings. xml? In android studio, you can simply press Alt+Enter and it will convert for you.
A string is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). So, you can combine string resources with other simple resources in the one XML file, under one <resources> element.
You can get text from strings by using @string
keyword.
<TextView
android:text="@string/advices"
android:textColor="#999999"
android:textStyle="bold"
android:textSize="12sp" />
and there is an another way to do this :
->> Right click on the TextView
on which you want to set text from strings
. Select EditText
from the menu or alternatively you can press F2 Function Key
->> Now all strings
will be listed which are available in your strings.xml
. Select the required string from list.
->> Now you can see your string
in your text view
.
First of all in your res folder, there will be values named folder in which you will have strings.xml file.In that file you have to put your all English String in it.
And now if you want to use another language like Spanish then make values-es named folder and put all Spanish meaning for English Language..
and set something like this:
<TextView
android:textColor="#999999"
android:textStyle="bold"
android:text="@string/string_here"
android:textSize="12sp" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With