GoSms 从alertDialog 中窃取焦点

发布于 2025-01-02 05:53:56 字数 688 浏览 3 评论 0原文

我有一个收到消息时弹出的警报对话框。只要 goSms 不干扰,它就可以正常工作。当使用 goSms 启用弹出选项时,我的警报会弹出,但位于 go sms 弹出窗口后面,并且 goSms 弹出窗口是透明的。在我的警报获得焦点并实际记录触摸之前,我必须点击关闭按钮几次。

   final AlertDialog d = new AlertDialog.Builder(ctx)
    .setTitle(title)
    .setMessage(message)
        .setCancelable(false)
        .setIcon(R.drawable.ic_alert)
        .setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                //finish();
                dialog.dismiss();
            }
        })
    .create();

    d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

如何让我的alertDialog在创建时获得焦点?

I have an alertDialog that pops up when a message is received. It works fine, as long as goSms doesnt interfere. When the popup option is enabled with goSms, my alert pops up, but behind the go sms popup, and the goSms popup is transparent. I have to tap the dismiss button a few times before my alert obtains focus and actually registers the touch.

   final AlertDialog d = new AlertDialog.Builder(ctx)
    .setTitle(title)
    .setMessage(message)
        .setCancelable(false)
        .setIcon(R.drawable.ic_alert)
        .setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                //finish();
                dialog.dismiss();
            }
        })
    .create();

    d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

How can I get my alertDialog to pull focus when its created?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅听莫相离 2025-01-09 05:53:56

您可以尝试为应用程序的广播接收器提供非常高的优先级。
<意图过滤器 android:icon="可绘制资源"
android:label="字符串资源"
android:priority="HIGH_VALUE_INTEGER" >
。 。 .
< /intent-filter>

需要理解的是,具有高优先级的人将首先访问该通知。

有关此的更多信息:
http://developer.android.com/guide/topics/manifest/intent-filter-element.html
http://developer.android.com/reference/android/content/BroadcastReceiver.html

you can try to give a very high valu of priority to your broadcast receiver of your app.
< intent-filter android:icon="drawable resource"
android:label="string resource"
android:priority="HIGH_VALUE_INTEGER" >
. . .
< /intent-filter>

Thing to understand is that one with the high priority will get access to that notification first.

More infor regarding this :
http://developer.android.com/guide/topics/manifest/intent-filter-element.html
http://developer.android.com/reference/android/content/BroadcastReceiver.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文