怎么使用字符串String配置文件正的资源

来源:互联网 发布:朝鲜水灾知乎 编辑:程序博客网 时间:2024/05/16 15:09


1. getstring

// Get a string resource from your app's ResourcesString hello = getResources().getString(R.string.hello_world);

2.R.string

// Or supply a string resource to a method that requires a stringTextView textView = new TextView(this);textView.setText(R.string.hello_world)


3. @string

<TextView    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="@string/hello_world" />



0 0
原创粉丝点击