嗨,大家好,我是新来的,这是我的第一个问题
这是我的代码:
<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"
/>
我不想在第二次测试中使用字符串我该怎么办?
解决方法
没问题,你正在使用硬编码的字符串.
如果您想了解更多信息,请查看: https://stackoverflow.com/a/8743887/1517996
如果您想了解更多信息,请查看: https://stackoverflow.com/a/8743887/1517996
strings.xml中
<resources>
<string name="Test">Test</string>
<resources>
并使用它像lin布局文件
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Test"
/>