l<wbr></wbr>字符串资源的定义
文件路径:res/values/strings.xml
字符串资源定义示例:
<?xml<wbr>version="1.0"<wbr>encoding="utf-8"</wbr></wbr>?>
<resources>
<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr><string<wbr></wbr>name="hello">Hello!</string>
</resources>
<wbr></wbr>
l<wbr></wbr>字符串资源的调用
ü<wbr></wbr>在Layout XML调用字符串资源:
<TextView
<wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr>android:layout_width="fill_parent"
<wbr><wbr><wbr><wbr>android:layout_height</wbr></wbr></wbr></wbr>="wrap_content"
<wbr><wbr><wbr><wbr>android:text</wbr></wbr></wbr></wbr>="@string/hello"<wbr></wbr>/>
ü<wbr></wbr>在Activity获取字符串资源:
this.getString(R.string.hello)
ü<wbr></wbr>从Context获取字符串资源:
context.getString(R.string.hello)
ü<wbr></wbr>从Application获取字符串资源:
application.getString(R.string.hello)