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

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

    • <bdo id='P1oDp'></bdo><ul id='P1oDp'></ul>

      如何在android中创建模态对话框

      时间:2023-05-16
      <tfoot id='MPaph'></tfoot>

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

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

          <legend id='MPaph'><style id='MPaph'><dir id='MPaph'><q id='MPaph'></q></dir></style></legend>
          • <bdo id='MPaph'></bdo><ul id='MPaph'></ul>

                <tbody id='MPaph'></tbody>

                本文介绍了如何在android中创建模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我想为我的应用程序创建模式对话框.

                i want create modal dialog box for my application.

                所以当模态对话框打开时,其他活动被阻止.没有像按下后退按钮或按下主页按钮那样完成任何事件.

                so when modal dialog box open the other activities are blocked. no event are done like back button press or home button press.

                并在该对话框中放置两个选项按钮取消并确定.

                and put two option button in that dialog box cancel and ok.

                谢谢...

                推荐答案

                Android中有很多种Dialogs.请查看 对话框.我猜你正在寻找类似 AlertDialog 的东西.这是如何在 BackPress 按钮上实现的示例.

                There are many kind of Dialogs in Android. Please take a look at Dialogs. I guess what you are looking for is something like AlertDialog . This is the example of how you can implement on BackPress button.

                @Override
                public void onBackPressed() {
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.setTitle("Do you want to logout?");
                    // alert.setMessage("Message");
                
                    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            //Your action here
                        }
                    });
                
                    alert.setNegativeButton("Cancel",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            }
                        });
                
                    alert.show();
                
                }
                

                这篇关于如何在android中创建模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:NSApp 的 ModalForWindow、NSAlert 的 ModalForWindow 和 ModalSessi 下一篇:SwiftUI:清除模态状态或重新初始化

                相关文章

                <legend id='8YkgD'><style id='8YkgD'><dir id='8YkgD'><q id='8YkgD'></q></dir></style></legend>

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

                  <bdo id='8YkgD'></bdo><ul id='8YkgD'></ul>

                  1. <small id='8YkgD'></small><noframes id='8YkgD'>

                    <tfoot id='8YkgD'></tfoot>