Android - Resource 之 String 小结

简单的string:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string
        name="string_name"
        >text_string</string>
</resources>
String string = getString(R.string.hello);

 

string数组:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array
        name="string_array_name">
        <item
            >text_string</item>
    </string-array>
</resources>
resources res = getResources();
String[] planets = res.getStringArray(R.array.planets_array);

 

Quantity String(Plurals  复数)

 

你可能感兴趣的:(Android - Resource 之 String 小结)