DialogFragment 相对于 AlertDialog 的优势 [英] DialogFragment advantages over AlertDialog

查看:34
本文介绍了DialogFragment 相对于 AlertDialog 的优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发 Android 应用程序时,我读到建议使用 DialogFragment 而不是直接使用 AlertDialog 来显示警报和确认.

When developing an Android app, I've read that it's recommended to use DialogFragment instead of using directly an AlertDialog to show alerts and confirmations.

这是在 DialogFragment 的文档中完成的:http://developer.android.com/reference/android/app/DialogFragment.html

This is done, for example, on DialogFragment's Documentation: http://developer.android.com/reference/android/app/DialogFragment.html

人们也说他们更喜欢这里:Android DialogFragment vs Dialog

People also say they prefer this here: Android DialogFragment vs Dialog

我想知道这种方法的优点,因为代码变得更加复杂.

I would like to know the advantages of this approach, since the code becomes more complex.

谢谢

推荐答案

在 Dialog 上使用 DialogFragment:

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