我目前正在開發Android應用程序,並且已經進行了大約六週。我發現它還需要以不同的語言運行。我所有的字符串資源都保存在strings.xml
文件中。是否可以在兩個strings.xml文件中進行選擇?
我想知道的是,如果我可以製作一個單獨的文件,如strings2.xml
,並根據用戶選擇的內容,程序將爲所有字符串引用選擇strings.xml or strings2.xml
。我的佈局文件main.xml
。
<Button
android:id="@+id/more_parametersButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/more_parameters" />
然後,我會有2個單獨的字符串文件。 的strings.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="more_parameters">More Parameters</string>
</resources>
和strings2.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="more_parameters">Mais Parâmetros</string>
</resources>
看起來這是不可能的,但如果是這樣,我會很感激的信息。