What is the difference between PopUpWindow and Dialog?

后端 未结 3 1485
小蘑菇
小蘑菇 2021-02-13 04:07

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?

相关标签:
3条回答
  • 2021-02-13 04:38

    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 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).

    -Capable of adding any view

    -Easy to edit

    -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

    "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 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.

    -Simpler

    -Easier to code

    -It's more standard so it'll be harder for the user to be confused with it

    0 讨论(0)
  • 2021-02-13 04:44

    Dialog is designed for taking controlled action on popup events where you need to take action before proceed to continue next. It's auto-adjustable with the screen at center aligned manner.

    But PopupWindow is informative popup which deals as layout. It can be shown anywhere in the screen as per position set and You can also use this with animated form as there is animation facility also with it.

    So if you are looking for just show the information in popup then I suggest use PopupWindow and if you want some action control like "YES", "No" or any decision making action then go with Dialog.

    0 讨论(0)
  • 2021-02-13 04:49

    Here are the differences between popup box and dialog box. A dialog box typically has a question(s) and a prompt for an answer within the box itself. For example, the box may have dialog that says, "Do you want to close the window? There might be button such as CANCEL, YES, NO.

    Therefore, there is a simulated dialog between the box and the user.

    In a popup box, although there may be required input or selections from menus, dropdowns, etc., there will typically be no dialog because the box information itself is intuitive for the user.

    Hope that helps to clarify it for you.

    0 讨论(0)
提交回复
热议问题