ANDROID:我怎样才能从所有窗口顶部的通知或长期pressed搜索按钮启动弹出对话框? [英] ANDROID: How can I launch a popup dialog from an notification or long-pressed search button on top of all windows?

查看:198
本文介绍了ANDROID:我怎样才能从所有窗口顶部的通知或长期pressed搜索按钮启动弹出对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已搜查,一切即将开展的活动不是一个对话框。

I have searched and everything is about launching an activity not a dialog.

我想要做的是显示在状态栏上的通知,并在用户presses它弹出一个对话框上的任何用户呈S之前观看的顶部/他点击该通知。我不想在对话框上显示的主要活动还是最近的应用列表的顶部。

What I want to do is to display a notification in the status bar, and when the user presses it a dialog pops up on top of whatever the user was viewing before s/he clicked the notification. I dont want the dialog to show on top of the main activity or the recent apps list.

此外,我怎么能推出从长期$ P $对话框pssing搜索按钮?

Also, how can i launch the dialog from long pressing the search button?

谢谢!

推荐答案

我复制另一个答案的 Android的活动作为一个对话框

要启动活动的对话我定义

to Start activity as dialog i defined

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

现在,当我 startActivity()显示它像回到对话和家长的活动显示,i湾一个按钮,我向他们单击对话框应该解雇和家长的活动应该显示不刷新页面。

now when i startActivity() it display like dialog and parent activity display on back, i wan a button to whom i click dialog should dismiss and parent activity should display without refreshing the page.

然后有人添加的注释:

使用Android:主题=@安卓风格/ Theme.Dialog是的路要走,但不要忘了用excludeFromRecents = TRUE,否则您的对话框将出现在最近使用的应用程序(按住Home键)。

Using the android:theme="@android:style/Theme.Dialog" is the way to go but don't forget to use excludeFromRecents=true or else your dialog will appear in the Recently Used Apps (hold the Home key).

和为长preSS,重写 onKeyLong preSS(INT键code,KeyEvent的事件)键,就可以使长期preSS做你想要什么。
<一href=\"http://developer.android.com/reference/android/view/View.html\">http://developer.android.com/reference/android/view/View.html

And for the long press, override onKeyLongPress(int keyCode, KeyEvent event) and you can make the long press do what you want. http://developer.android.com/reference/android/view/View.html

这篇关于ANDROID:我怎样才能从所有窗口顶部的通知或长期pressed搜索按钮启动弹出对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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