Solution to the "activity disguise" dialog problem in Android

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.