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

    2. <tfoot id='bhVd4'></tfoot>
      <legend id='bhVd4'><style id='bhVd4'><dir id='bhVd4'><q id='bhVd4'></q></dir></style></legend>
        <bdo id='bhVd4'></bdo><ul id='bhVd4'></ul>

      1. 如何在对话框中处理后退按钮?

        时间:2023-08-31
        1. <legend id='OnuGK'><style id='OnuGK'><dir id='OnuGK'><q id='OnuGK'></q></dir></style></legend>

          1. <tfoot id='OnuGK'></tfoot>

                <tbody id='OnuGK'></tbody>

              <small id='OnuGK'></small><noframes id='OnuGK'>

                <bdo id='OnuGK'></bdo><ul id='OnuGK'></ul>
                  <i id='OnuGK'><tr id='OnuGK'><dt id='OnuGK'><q id='OnuGK'><span id='OnuGK'><b id='OnuGK'><form id='OnuGK'><ins id='OnuGK'></ins><ul id='OnuGK'></ul><sub id='OnuGK'></sub></form><legend id='OnuGK'></legend><bdo id='OnuGK'><pre id='OnuGK'><center id='OnuGK'></center></pre></bdo></b><th id='OnuGK'></th></span></q></dt></tr></i><div id='OnuGK'><tfoot id='OnuGK'></tfoot><dl id='OnuGK'><fieldset id='OnuGK'></fieldset></dl></div>
                • 本文介绍了如何在对话框中处理后退按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在开发一个应用程序,当按下按钮时,它会打开一个带有确定和取消按钮的对话框.

                  I am developing an application that when the button is pressed, it opens a dialog with OK and Cancel buttons.

                  效果很好.

                  当用户按下后退按钮时,我按如下方式处理

                  When the user presses the back button, I am handling this as follows

                  public boolean onKeyDown(int keyCode, KeyEvent event) 
                  {
                      if ((keyCode == KeyEvent.KEYCODE_BACK)) 
                      {
                  
                      }
                   return super.onKeyDown(keyCode, event);
                  }
                  

                  但是上面的方法没有被调用.我该如何处理?

                  But the above method is not called. How can I handle this?

                  推荐答案

                  dialog.setOnKeyListener(new Dialog.OnKeyListener() {
                  
                              @Override
                              public boolean onKey(DialogInterface arg0, int keyCode,
                                      KeyEvent event) {
                                  // TODO Auto-generated method stub
                                  if (keyCode == KeyEvent.KEYCODE_BACK) {
                                      finish();
                                      dialog.dismiss();
                                  }
                                  return true;
                              }
                          });
                  

                  这篇关于如何在对话框中处理后退按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:检测后退按钮但不关闭对话框片段 下一篇:调用android对话框而不褪色背景

                  相关文章

                  最新文章

                  • <bdo id='pelMi'></bdo><ul id='pelMi'></ul>
                  <tfoot id='pelMi'></tfoot>

                    <small id='pelMi'></small><noframes id='pelMi'>

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