What is the difference between PopUpWindow and Dialog?

Basically the question is indicated in the title. Any preferences for using one or the other? Maybe some specific tasks when one is superior / more efficient / better than the other?

+6
source share
3 answers

Dialog

"A dialog is a small window in which the user is prompted to make a decision or enter additional information. The dialog box does not fill the screen and is usually used for modal events that require users to take action before they can continue."

AlertDialog has many options, and as far as I can guess your problem, you can have a cross button in the upper right corner of the dialog box too (you can set icons anywhere since you can provide a custom layout for AlertDialog).

- Ability to add any kind

- easy to edit

- Can be adapted to tablets or mobile phones in landscape or portrait, just by changing the layout

-Can highlights a whole new class to change it in its path

Popup windows

"This class is a popup window that can be used to display an arbitrary view. A popup window is a floating container that appears on top of the current activity."

PopupWindow is another tool to customize your custom pop-up window anywhere on the screen. If you always show this popup in the middle of the screen, I would suggest not using it. AlertDialog should work fine.

-Simpler

-Easier for code

-It is more standard, so it will be difficult for the user to go astray with him

+2
source

Here are the differences between a popup and a dialog box. A dialog box usually has a question and a hint for an answer inside the window itself. For example, a window may have a dialog box that says: "Do you want to close the window? There may be buttons such as CANCEL, YES, NO.

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

In the pop-up window, although it may require input or selection from the menu, drop-down menus, etc., usually there will be no dialogue, because the information about the box itself is intuitive for the user.

Hope that helps clarify this for you.

0
source

The dialog is designed to take controlled action in pop-up events where you need to take action before proceeding further. It is automatically adjusted using the center-aligned screen.

But PopupWindow is an informative popup that deals with layout. It can be displayed anywhere on the screen in accordance with the specified position, and you can also use it with an animated form, as it also has animation.

So, if you just want to view the information in a pop-up window, I suggest using PopupWindow, and if you want some kind of action control, such as β€œYES”, β€œNo” or some kind of decision-making action, go to Dialog .

0
source

Source: https://habr.com/ru/post/925012/


All Articles