• <tfoot id='okrCd'></tfoot>

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

    <legend id='okrCd'><style id='okrCd'><dir id='okrCd'><q id='okrCd'></q></dir></style></legend>
  • <small id='okrCd'></small><noframes id='okrCd'>

      1. 覆盖对话框 onBackPressed()?

        时间:2023-08-30

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

                  <tbody id='m511y'></tbody>

                  <legend id='m511y'><style id='m511y'><dir id='m511y'><q id='m511y'></q></dir></style></legend>
                  本文介绍了覆盖对话框 onBackPressed()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何覆盖 DialogonBackPressed 以关闭对话框以及在 Activity 上调用 finish()它位于?

                  How would I override a Dialog's onBackPressed to close the dialog as well as calling finish() on the Activity it is located in?

                  推荐答案

                  可以使用setOnCancelListener:

                  dialog.setOnCancelListener(new DialogInterface.OnCancelListener()
                  {
                      @Override
                      public void onCancel(DialogInterface dialog)
                      {
                           MyActivity.this.finish();
                      }
                  });
                  

                  您只需完成您的活动.对话框将自动关闭.

                  You need to finish only your activity. Dialog will be dismissed automatically.

                  这篇关于覆盖对话框 onBackPressed()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                        <bdo id='fS6er'></bdo><ul id='fS6er'></ul>

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

                            <tbody id='fS6er'></tbody>
                          <tfoot id='fS6er'></tfoot>

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