How does Froyo display a Dialog atop the home screen?

懵懂的女人 提交于 2020-01-03 19:02:16

问题


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:


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.



来源:https://stackoverflow.com/questions/3167843/how-does-froyo-display-a-dialog-atop-the-home-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!