android dialog dismiss cancel hide 的区别
发布日期:2021-09-30 11:34:33
浏览次数:7
分类:技术文章
本文共 1175 字,大约阅读时间需要 3 分钟。
dismiss
/** * Dismiss this dialog, removing it from the screen. This method can be * invoked safely from any thread. Note that you should not override this * method to do cleanup when the dialog is dismissed, instead implement * that in {@link #onStop}. */ @Override public void dismiss() { if (Looper.myLooper() == mHandler.getLooper()) { dismissDialog(); } else { mHandler.post(mDismissAction); } }
cancel
/** * Cancel the dialog. This is essentially the same as calling {@link #dismiss()}, but it will * also call your {@link DialogInterface.OnCancelListener} (if registered). */ public void cancel() { if (!mCanceled && mCancelMessage != null) { mCanceled = true; // Obtain a new message so this dialog can be re-used Message.obtain(mCancelMessage).sendToTarget(); } dismiss(); }
hide方法
/** * Hide the dialog, but do not dismiss it. */ public void hide() { if (mDecor != null) { mDecor.setVisibility(View.GONE); } }
总结:最终都会调用 dismiss方法
然后cancel会调用 onCancelListener 同时会调用 dismissListener
转载地址:https://blog.csdn.net/id19870510/article/details/52924195 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
不错!
[***.144.177.141]2024年04月17日 16时32分43秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
重绘和回流(重排)是什么,如何避免?
2019-04-30
css3的animation
2019-04-30
左边宽度固定,右边自适应布局
2019-04-30
两种以上方式实现已知或者未知宽度的垂直水平居中
2019-04-30
如何实现小于12px的字体效果
2019-04-30
JavaScript 闭包
2019-04-30
作用域链的理解
2019-04-30
JavaScript原型,原型链
2019-04-30
vue、react、angular小小比较
2019-04-30
Node的应用场景
2019-04-30
js数据类型
2019-04-30
js有哪些内置对象
2019-04-30
eval是做什么的
2019-04-30
null,undefined 的区别
2019-04-30
javascript 代码中的“use strict“
2019-04-30
JSON 的了解
2019-04-30
defer和async
2019-04-30
严格模式的限制
2019-04-30
attribute和property的区别是什么
2019-04-30
面向对象编程思想
2019-04-30