硬codeD串QUOT;测试与QUOT ;,应该使用@string资源
问题描述:
喜家伙我是新来的,这是我的第一个问题。
Hi guys I'm new here and this is my very first problem
这是我的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"
/>
我不希望使用字符串中的第二个测试我应该怎么办?
I don't want to use string in the second test what should i do ?
答
这是您正在使用的字符串硬codeD或不是没有问题。
如果您想了解更多信息,你可以看看: http://stackoverflow.com/a/8743887/1517996
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
strings.xml
<resources>
<string name="Test">Test</string>
<resources>
和使用它像
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Test"
/>