字符串資源的定義
文件路徑:res/values/strings.xml
字符串資源定義示例:
<resources>
<string name="hello">Hello!</string>
</resources>
字符串資源的調用
在 Layout XML 調用字符串資源:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
在 Activity 獲取字符串資源:
從 Context 獲取字符串資源:
從 Application 獲取字符串資源: