文件名:
res/values/filename.xml
文件内容:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello!</string>
</resources>
代码使用:
String string = getString(R.string.hello);
如果是
String Array
R.array.string_array_name
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="planets_array">
<item>Mercury</item>
<item>Venus</item>
<item>Earth</item>
<item>Mars</item>
</string-array>
</resources>
使用:
Resources res = getResources();
String[] planets = res.getStringArray(R.array.planets_array);