<i id='aM333'><tr id='aM333'><dt id='aM333'><q id='aM333'><span id='aM333'><b id='aM333'><form id='aM333'><ins id='aM333'></ins><ul id='aM333'></ul><sub id='aM333'></sub></form><legend id='aM333'></legend><bdo id='aM333'><pre id='aM333'><center id='aM333'></center></pre></bdo></b><th id='aM333'></th></span></q></dt></tr></i><div id='aM333'><tfoot id='aM333'></tfoot><dl id='aM333'><fieldset id='aM333'></fieldset></dl></div>

      <bdo id='aM333'></bdo><ul id='aM333'></ul>
  • <legend id='aM333'><style id='aM333'><dir id='aM333'><q id='aM333'></q></dir></style></legend>
    1. <small id='aM333'></small><noframes id='aM333'>

    2. <tfoot id='aM333'></tfoot>

        当我单击搜索按钮时,防止 ProgressDialog 被关闭

        时间:2023-08-31
          <tbody id='Kv8vR'></tbody>
        <i id='Kv8vR'><tr id='Kv8vR'><dt id='Kv8vR'><q id='Kv8vR'><span id='Kv8vR'><b id='Kv8vR'><form id='Kv8vR'><ins id='Kv8vR'></ins><ul id='Kv8vR'></ul><sub id='Kv8vR'></sub></form><legend id='Kv8vR'></legend><bdo id='Kv8vR'><pre id='Kv8vR'><center id='Kv8vR'></center></pre></bdo></b><th id='Kv8vR'></th></span></q></dt></tr></i><div id='Kv8vR'><tfoot id='Kv8vR'></tfoot><dl id='Kv8vR'><fieldset id='Kv8vR'></fieldset></dl></div>

            • <legend id='Kv8vR'><style id='Kv8vR'><dir id='Kv8vR'><q id='Kv8vR'></q></dir></style></legend>

              • <small id='Kv8vR'></small><noframes id='Kv8vR'>

                • <bdo id='Kv8vR'></bdo><ul id='Kv8vR'></ul>
                  <tfoot id='Kv8vR'></tfoot>
                  本文介绍了当我单击搜索按钮时,防止 ProgressDialog 被关闭(Android)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在长时间运行的操作中,我显示了一个弹出对话框(从 ProgressDialog 创建以防止发生其他操作).

                  In a long-running operation, I'm showing a popup dialog (created from ProgressDialog to prevent other operations from happening).

                  我已使用 setCancelable(false) 使其不可取消,因此我无法使用后退按钮将其关闭,但令人惊讶的是,搜索硬件按钮会关闭对话框!

                  I have made it non-cancellable with setCancelable(false), so I can't close it using the back button, but surprisingly, the Search hardware button dismisses the dialog!

                  更准确地说,显示了全局搜索应用程序,当我回到我的应用程序时,对话框已被关闭.

                  More exactly, the global search application is displayed, and when I come back to my app, the dialog has been dismissed.

                  知道如何防止对话框被关闭吗?

                  Any idea how to prevent the dialog from being dismissed?

                  推荐答案

                  这行得通(注意我把它放在对话框生成器上):

                  This works (notice I put it on the dialog builder):

                  .setOnKeyListener(new DialogInterface.OnKeyListener() {
                  
                      @Override
                      public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                          if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) {
                              return true; // Pretend we processed it
                          }
                          return false; // Any other keys are still processed as normal
                      }
                  })
                  

                  也许甚至可以抓住正负按钮按下,处理这些,对任何其他键返回 true.如果你能弄清楚那会很好奇......

                  Maybe it's even possible to grab the positive and negative button presses, and only handle these, return true for any other keys. Would be curious if you can figure that out...

                  PS:我在某处读到对话框中有更多漏洞",即您无需点击任何按钮即可摆脱它.这显然是一个.有人知道其他人吗?

                  PS: I read somewhere there are more "holes" in the dialog, i.e you can get rid of it without hitting any buttons on it. This was apparently one. Does anybody know of any others?

                  这篇关于当我单击搜索按钮时,防止 ProgressDialog 被关闭(Android)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Activity 泄露了最初添加在这里的窗口 com.android. 下一篇:如何在对话框中使用数字选择器

                  相关文章

                  最新文章

                • <tfoot id='1WUi3'></tfoot>

                      <i id='1WUi3'><tr id='1WUi3'><dt id='1WUi3'><q id='1WUi3'><span id='1WUi3'><b id='1WUi3'><form id='1WUi3'><ins id='1WUi3'></ins><ul id='1WUi3'></ul><sub id='1WUi3'></sub></form><legend id='1WUi3'></legend><bdo id='1WUi3'><pre id='1WUi3'><center id='1WUi3'></center></pre></bdo></b><th id='1WUi3'></th></span></q></dt></tr></i><div id='1WUi3'><tfoot id='1WUi3'></tfoot><dl id='1WUi3'><fieldset id='1WUi3'></fieldset></dl></div>

                      <small id='1WUi3'></small><noframes id='1WUi3'>

                      <legend id='1WUi3'><style id='1WUi3'><dir id='1WUi3'><q id='1WUi3'></q></dir></style></legend>
                        <bdo id='1WUi3'></bdo><ul id='1WUi3'></ul>