How does Froyo display a Dialog atop the home scre

2019-07-05 01:31发布

I upgraded my Nexus One a few days ago with 2.2 (Froyo). This morning when I went to use it I saw a Dialog sitting atop the home/launcher screen notifying me that an update was available and that I could choose to upgrade now or later.

My question is, what API mechanisms is this using to show a Dialog (perhaps an AlertDialog) atop the home screen? Having written an Android app, it was my understanding that Dialogs could only be shown atop an Activity, and that a Service cannot show a Dialog (only a Toast).

Is Google perhaps skinning an Activity to look like a Dialog? Is there a new API method available for showing a Dialog without needing an Activity?

1条回答
Root(大扎)
2楼-- · 2019-07-05 02:28

You can theme an activity like the dialog, its been there for a while (i think 1.6, maybe even 1.5)

<activity android:name=".MyActivity" android:theme="@android:style/Theme.Dialog" />

That would produce what I believe you are seeing.

查看更多
登录 后发表回答