简体   繁体   中英

Create Dialog without activity

How can I implement such a dialog, no activity is running.
Is the activity invisible or what?

在此处输入图片说明

How can I implement such a dialog, no activity is running.

You can't.

Is the activity invisible or what?

Possibly, perhaps using Theme.Translucent.NoTitleBar .

More likely, what you think is a Dialog is really a dialog-themed Activity . The main themes (eg, Theme.Material , Theme.AppCompat ) have specific themes with Dialog in their names that cause the activity's window to not fill the entire screen.

In your dialog you need to set type of Window which dialog attached, as follows:

dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

Do not forget declaring android.permission.SYSTEM_ALERT_WINDOW permission in your manifest.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM