dru*_*abs 7 android android-alertdialog
AlertDialog的构建器类的.create()和.show()方法之间有什么区别吗?就像我们使用以下方法创建警报对话框时
AlertDialog.Builder builder = new
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("");
builder.setPositiveButton(....)
builder.setNegativeButton(....)
Run Code Online (Sandbox Code Playgroud)
什么是推荐使用的实践,为什么?
builder.create() //I have seen this creates and displays the dialog
Run Code Online (Sandbox Code Playgroud)
要么
builder.show() //this also displays the dialog
Run Code Online (Sandbox Code Playgroud)
要么
builder.create().show() //well same thing
Run Code Online (Sandbox Code Playgroud)
我已阅读文档.但无法从中得到任何意义.有任何想法吗 ?
obj.create()-For create Dialog
obj.show()-For show Dialog < - 如果没有它,你就不能在创建时显示对话框.
和
obj.create().show()-create and show Dialog i mean both same as above two in one statement.
| 归档时间: |
|
| 查看次数: |
4035 次 |
| 最近记录: |