DialogFragment不可取消
程序员文章站
2022-04-24 14:24:42
...
class LoadingDialog : DialogFragment() {
...
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val layout = requireActivity().layoutInflater.inflate(R.layout.loading_view, null)
val showText = layout.findViewById<TextView>(R.id.showMsgLoadingDialog)
showText.setText(msg)
val myDialog = requireActivity().run {
val builder = AlertDialog.Builder(this)
builder.setView(layout)
builder.create()
}
myDialog.setCancelable(false) //返回键不可取消
myDialog.setCanceledOnTouchOutside(false) //点击外部不取消
isCancelable=false //侧滑,Fragment不可取消
return myDialog
}
...
}
上一篇: js中opener与parent的区别详细解析_javascript技巧
下一篇: 阻塞操作不可取消