如何WhatsApp的弹出式通知工作? [英] How does WhatsApp pop-up notification work?

查看:1527
本文介绍了如何WhatsApp的弹出式通知工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图模仿的WhatsApp的弹出通知。
(如果你还没有看到它,它可能是一个有点难以让你明白这一点。)
下面是给一个更清晰的视角的图像。

I am trying to mimic the pop-up notification of WhatsApp. (If you have not seen it, it might be a bit hard for you to understand this.) Below is an image to give a clearer perspective.

有人建议,这可能使用的有 Theme.Holo.Light.Dialog.Alert 主题的oridnary活动来完成。然而,当我实现了,我得到了它应该是空的像一个对话框,该活动充满的意见(另一半)的一半,呈现出白色背景。也就是说,我没有对话的感觉。

Some suggested that this might be done using an oridnary activity which has the Theme.Holo.Light.Dialog.Alert theme. However, when I implemented that I got half of the activity full with the views (and the other half) which is supposed to be empty like a dialog, showing a white background. ie, I did not have the dialog feel.

Morever,当设备处于待机模式(电源按钮pressed)和锁定,WhatsApp的是能够绕过这一点,显示上面弹出的对话框中(或活动,或其他)。

Morever, when the device is in standby mode (power button pressed) and locked, whatsapp is able to bypass that and show the popup dialog (or activity, or whatever) above that.

任何想法如何实现这一点?

Any ideas how to implement this ?

推荐答案

天啊!几个小时后,我找到了解决办法!

Oh god! After hours, I found the solution!

请参考链接: http://developer.android.com/guide /topics/ui/dialogs.html#CustomLayout

这是非常容易,你只需要设置活动的主题@android:款式/ Theme.Holo.Dialog清单中,如:

It's extremely easy, you just need to set up the theme of the activity to @android:style/Theme.Holo.Dialog in manifest like:

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

这篇关于如何WhatsApp的弹出式通知工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆