PopUpWindow和Dialog有什么区别? [英] What is the difference between PopUpWindow and Dialog?
问题描述
基本上,问题在标题中指出.在使用一个或另一个方面有任何偏好吗?也许某些特定任务中,一项任务比另一项任务优越/效率更高/更好?
Basically the question is stated in the title. Any preferences in using one or another? Maybe some specific tasks where one is superior/ more efficient/ better than the other?
推荐答案
对话框
"A dialog
是一个小窗口,提示用户做出决定或输入其他信息.对话框不会填满屏幕,通常用于模态事件,要求用户先执行操作他们可以继续."
"A dialog
is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed."
AlertDialog
有很多变体,据我所知,您可以在对话框的右上角也有一个十字按钮(您可以在任何位置设置图标,因为您可以提供自定义布局进入AlertDialog).
AlertDialog
has many variants and as far as I can assume your problem, You can have a cross button too in the top-right corner of the dialog (You can set the icons anywhere, as you can provide a custom layout to an AlertDialog).
-可以添加任何视图
-易于编辑
-只需修改布局即可适用于横向或纵向的平板电脑或手机
-Can be adapted to tablets or cellphones in landscape or portrait just by modifying the layout
-可以专门设计一个全新的类
-Can dedicate a whole new class just to modify it your way
PopupWindows
此类表示popup window
,可用于显示任意视图.弹出窗口是显示在当前活动顶部的浮动容器."
"This class represents a popup window
that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity."
PopupWindow
是另一个可自定义屏幕上任意位置的自定义弹出窗口的工具.如果您总是在屏幕中间显示此弹出窗口,那么我建议您不要使用此弹出窗口. AlertDialog应该可以正常工作.
PopupWindow
is another tool to customize your custom pop up anywhere in the screen. If you're showing this popup always in the middle of the screen, then I would like to suggest not to use this. The AlertDialog should work fine.
-简单
-更易于编码
-这是更标准的,因此用户很难与它混淆
-It's more standard so it'll be harder for the user to be confused with it
这篇关于PopUpWindow和Dialog有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!