Let me name it like this, because it is an activity, but we see the effect of a dialog box, so I call it a disguised dialog, of course, it is also known as a floating activity. In Android, we often use the dialog class or its subclass (such as alertdialog) to create a dialog box. With this class, the pop-up dialog box is displayed.
However, you should know that there is another way to create a dialog box, that is, to use the theme of the activity dialog box, you can configure it by configuring its theme, we can go to androidmanifest. perform the following configurations in XML:
<Activity Android: Name = ". dialogactivity" Android: Label = "@ string/activity_dialog" Android: theme = "@ Android: style/theme. Dialog"> </activity>
I don't know if you have encountered such a situation. I have met you these days. I used the general method of creating a dialog box, but ignored the second method of creating a dialog box. At one time, I got stuck. Finally, today, when I think of this method and try it, I want to achieve it.
It is true that in general, the first method is enough to solve our problem. The premise is that there is no data in the layout of the dialog box, but if you want to implement a layout in the dialog box, to view the data, you must use the second method to create a dialog box, write an activity to bind the data, and then call it where you want to call it, you can achieve the effect.
The following shows the dialog box that I implemented in the first and second modes:
(1) Common Dialog implementation methods
(2) Effects of activity disguised as Dialog