1,为了国际化,Android建议将在屏幕上显示的文字定义在strings.xml中。只需要再提供一个string.xml文件,把里面的汉子信息都修改为其他国家语音,再运行程序时,android操作系统会根据用户手机的语言环境和国家来自动选择相应的string.xml文件。
2.定义string.xml 数值。
<?xml version="1.0"
encoding="utf-8"?>
<resources>
<string name="hello">Hello World, MainActivity!</string>
<string name="app_name">TestExample01</string>
</resources>
3.定义定义string数组(arrays.xml)。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="munber">
<item>一</item>
<item>二</item>
<item>三</item>
<item>四</item>
</string-array>
</resources>
4.定义颜色(colors.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FFFFFF</color>
</resources>
---getResources().getDrawable(R.string.black);
---getResources().getColor(R.string.black);
5.定义尺寸(dimens.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="height">80dip</dimen>
</resources>
---getResource().getDimension(R.string.height);
6.定义样式(styles.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="sharpText">
<item name="android:textSize">18sp</item>
<item name="android:textColor">#000000</item>
</style>
</resources>
原文转自:http://blog.sina.com.cn/s/blog_5a6f39cf0101c8cf.html