如何从strings.xml文件中获取文本到我的.setmessage?
show = new AlertDialog.Builder(mContext).setTitle("moria")
.setMessage("R.string.erroroik")
.setPositiveButton("OK", null).show();
Run Code Online (Sandbox Code Playgroud)
您可以通过上下文访问它,具体取决于DialogBuilder的确切位置
context.getString(R.string.erroroik);
Run Code Online (Sandbox Code Playgroud)
要么
this.getString(R.string.erroroik);
Run Code Online (Sandbox Code Playgroud)
查看字符串资源以获取更多信息.
show = new AlertDialog.Builder(mContext).setTitle("moria")
.setMessage(R.string.erroroik)
.setPositiveButton("OK", null).show();
Run Code Online (Sandbox Code Playgroud)
完毕
| 归档时间: |
|
| 查看次数: |
14705 次 |
| 最近记录: |