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

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

        Android - 如何在 onPause 中关闭所有对话框

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

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

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

              <tbody id='gjxj7'></tbody>

                <bdo id='gjxj7'></bdo><ul id='gjxj7'></ul>
                <legend id='gjxj7'><style id='gjxj7'><dir id='gjxj7'><q id='gjxj7'></q></dir></style></legend>
                • 本文介绍了Android - 如何在 onPause 中关闭所有对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个活动可以在运行时显示不同的对话框.我使用 onCreateDialog(int id) 创建每个对话框,并使用 showDialog(int id) 和 dismissDialog(int id) 方法分别显示和关闭每个对话框.

                  I have an activity that could show different dialogs during run-time. I use onCreateDialog(int id) to create each dialog and I use showDialog(int id) and dismissDialog(int id) method show and dismiss each dialog respectively.

                  当 onPause() 被调用时,我不知道正在显示哪个对话框(如果有的话).我想确保在调用 onPause 时,所有对话框都被关闭.有没有推荐的方法来关闭所有对话框?我是否必须为每个对话框调用dismissDialog()?

                  When onPause() is called, I don't know which dialog (if any) is being displayed. I want to make sure that when onPause is called, all dialogs are dimissed. Is there a recommended way to dismiss all dialogs? Would I have to call dismissDialog() for each dialog?

                  推荐答案

                  取决于我们正在谈论的对话框数量.简短的回答是肯定的,您必须关闭每个对话框.

                  Depending on how many dialog's we're talking about. The short answer is yes, you'll have to dismiss each dialog.

                  除了简单地在活动级别声明一些对话框之外,可能还有其他优雅的方法可以做到这一点.一旦声明它们,您可以将所有对话框存储在 HashMap 中,然后遍历列表并在暂停时关闭每个对话框.

                  There may be elegant ways of doing this other than simply having a few dialogs declared at the activity level. You could store all the dialogs in a HashMap once they are declared and then iterate through the list and close each one onPause.

                  由于您不知道哪些是开放的,您需要通过并测试或跟踪状态.

                  Since you don't know which are open you'll need to go through and test or track the states.

                  但是,如果您的屏幕上确实有这么多对话框,则您的 UI/UX 设计可能会出现一些问题,因为 Android 应该为您提供一个模型,该模型可以轻松实现它,而不会出现看似糟糕的设计.

                  However, if you truly have this many dialogs on your screen you may have some issues with your UI/UX design as Android should give you a model which makes it easy to implement it without what seems like poor design.

                  这篇关于Android - 如何在 onPause 中关闭所有对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:活动作为android中的对话框 下一篇:错误的窗口令牌,您无法在创建 Activity 之前或隐

                  相关文章

                  最新文章

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

                    1. <legend id='bhGQ2'><style id='bhGQ2'><dir id='bhGQ2'><q id='bhGQ2'></q></dir></style></legend>

                    2. <small id='bhGQ2'></small><noframes id='bhGQ2'>