我有一個疑問,是否應該在我們的佈局文件中使用strings.xml文件中的所有字符串文本,還是應該我們在佈局文件本身的「字符串文本」中輸入屬性值,如android:text="some text"
。我們是否應該在Strings.xml中提供字符串值,還是在輸出xml文件本身
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/ll1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:text="Button"
android:id="@+id/butShow"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
則是罰款給android:text="Button"
還是應該使用android:text="@string/btnlabel"
的strings.xml
<resources>
<string name="btnLabel">Button</string>
</resources>
我們應該指定的strings.xml或只有特定的人所有的字符串文本。
ü可以寫代碼 – Randroid