文件路径:res/values/strings.xml
<resources>
<string name="main_version_title">版本号:</string>
</resources>
在 Layout XML 调用字符串资源:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/main_version_title" />
Activity 获取字符串资源:
this.getString(R.string.main_version_title)
Context 获取字符串资源:
context.getString(R.string.main_version_title)
Application 获取字符串资源:
application.getString(R.string.main_version_title)
getResources().getString(R.string.main_version_title);
Android从res/values/strings.xml获取字符串文件路径:res/values/strings.xml <resources> <string name="main_ve
最新推荐文章于 2020-04-11 12:18:21 发布