String Resource
String Resource
Página 1 de 2
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no
Tell me more ×
registration required.
here is my code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ref"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Test"
/>
android-layout
1 Answer
No problem that you are using the string hardcoded or not. If you want further information you could look:
http://stackoverflow.com/a/8743887/1517996
strings.xml
<resources>
<string name="Test">Test</string>
<resources>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Test"
/>
I already saw that link but i dont want any error on my code :/ is there any way to avoid this error ? – Edli Aug
3 '12 at 13:14
http://stackoverflow.com/questions/11795206/hardcoded-string-test-should-use-string... 03/10/2013
android layout - Hardcoded string "Test", should use @string resource - Stack Over... Página 2 de 2
this is not an error, this is a warning. If you dont want this warning you should implement your "Test" string in
strings.xml as <string name="Test">Test</string> and use it like <TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/Test" /> please see my edited post –
CodersParadise Aug 3 '12 at 13:20
Thanks alot !!! You really help me – Edli Aug 3 '12 at 13:51
Not the answer you're looking for? Browse other questions tagged android-layout or
ask your own question.
http://stackoverflow.com/questions/11795206/hardcoded-string-test-should-use-string... 03/10/2013