开发者

Showing a Dialog and still delivering clicks to the background?

I want to show a small Custom Dialog on top of the current user activity, 开发者_运维问答but have clicks to the area outside of my Dialog delivered to the background (which would be the launcher, or another activity). I tried to create a transparent base-activity and have the Dialog shown on top of it, but clicks are registered on the transparent activity and not on whatever is behind it...

I know that a Popup has a setOutsideTouchable-Method, but setting this to true just dismisses the popup, rather than delivering clicks to the background, to my knowledge...

Thanks for your help,

Nick


Based on this clarification comment you posted on another answer...

"I want the Dialog to be shown system-wide, no matter which App the user is using at the moment..."

I don't believe what you want to do is possible and I'm happy about that. :) If you were allowed to popup a little dialog box over anyone else's app and still have the user be able to interact with the current activity... then you could easily trick the user into thinking that the little popup belonged to the current app and not yours which is acting from the background.

Imagine all of the evil you could do with something like that. Prompting for the user to reenter their email password when they are in the Email.app.. and then just storing it for malicious purposes, etc.

It isn't possible.. and SHOULDN'T be possible. If you need to notify the user of something, then you should use the built-in notification system. That's why it is there! :)


You can use a PopupWindow "Dialog like" and show it for the user in top of your activity. The outside events will be delivered to the main Activity.


I can't see the deeper meaning of exploiting the using the given usability patterns of android by doing what you ask for?

It is recommended and meaningful to stick to common patterns so users don't have to adapt in basic apps. That is, unless you are working on a game:)


"I want the Dialog to be shown system-wide, no matter which App the user is using at the moment..."

That is what the notification system is for. It allows you to tell something to the user without interrupting him in whatever he was doing.

System wide dialog popup are evil and gladly not implemented in Android.

Use the notification system : http://developer.android.com/reference/android/app/Notification.html

Also if you are ok with only a dialog above YOUR app, then the simplest way to let the UI be still responsive while your dialog is up, is simply to recreate a dialog in a relativelayout view and display this instead of the common modal dialog.


You could switch places so that the popup is actually "behind" the initial screen, but then set the initial screen as transparent.

Edit: This would only be applicable within an application of course.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜