什么是活动主题,其之间的型动物是对话和类扩展对话框? [英] What's the differents between Activity which theme is Dialog and the class extends Dialog?

查看:121
本文介绍了什么是活动主题,其之间的型动物是对话和类扩展对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要显示一个对话框,有2种方式。

To show a Dialog , there are 2 ways.

1.Activity,主题是@android:款式/ Theme.Dialog
2.Class扩展对话框

1.Activity, theme is @android:style/Theme.Dialog 2.Class extends Dialog

但是,有什么不同?

和各自的优势和劣势?

这情况下,我要使用它们?

which situation should I use them?

推荐答案

如果您扩展对话框类,那么您可以使用对话框,在实际活动(需要显示对话框的)层。如果您创建一个显示一个对话框,然后活动让你回调用活动只是为了显示一个对话框。

If you extend Dialog class then you can use the Dialog as a layer over the actual Activity (the one that needs to show the Dialog). If you create an Activity that shows a Dialog then you let back the calling activity just for showing a Dialog.

我认为主要的区别在于,一个是活动和其他可以作为一个片段,因此可以是另一个活动里面的一层。

I think the main difference is that one is an Activity and the other can be used as a Fragment and thus can be a layer inside another Activity.

这篇关于什么是活动主题,其之间的型动物是对话和类扩展对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆