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

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

      <legend id='UrZTZ'><style id='UrZTZ'><dir id='UrZTZ'><q id='UrZTZ'></q></dir></style></legend>

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

      <i id='UrZTZ'><tr id='UrZTZ'><dt id='UrZTZ'><q id='UrZTZ'><span id='UrZTZ'><b id='UrZTZ'><form id='UrZTZ'><ins id='UrZTZ'></ins><ul id='UrZTZ'></ul><sub id='UrZTZ'></sub></form><legend id='UrZTZ'></legend><bdo id='UrZTZ'><pre id='UrZTZ'><center id='UrZTZ'></center></pre></bdo></b><th id='UrZTZ'></th></span></q></dt></tr></i><div id='UrZTZ'><tfoot id='UrZTZ'></tfoot><dl id='UrZTZ'><fieldset id='UrZTZ'></fieldset></dl></div>
    1. 如何将 Android Spinner 创建为弹出窗口?

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

          <legend id='UouRG'><style id='UouRG'><dir id='UouRG'><q id='UouRG'></q></dir></style></legend>
            <tbody id='UouRG'></tbody>

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

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

              1. 本文介绍了如何将 Android Spinner 创建为弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我想在用户点击菜单项以允许用户选择一项时调出一个微调对话框.

                I want to bring up a spinner dialog when the user taps a menu item to allow the user to select an item.

                我需要一个单独的对话框,还是可以直接使用 Spinner?我看到 这个链接, 提到了一个 MODE_DIALOG 选项,但它似乎不再被定义了.AlertDialog 可能没问题,但所有选项都说单击列表中的项目不会关闭对话框",这是我想要的.有什么建议吗?

                Do I need a separate dialog for this or can I use Spinner directly? I see this link, mentions a MODE_DIALOG option but it doesn't seem to be defined anymore. AlertDialog may be OK but all the options say "clicking on an item in the list will not dismiss the dialog" which is what I want. Any suggestion?

                理想情况下,代码类似于屏幕上显示微调器的情况:

                Ideally, the code would be similar to the case where the spinner is shown on the screen:

                ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity,
                     android.R.layout.simple_spinner_item, items);              
                adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                myspinner.setAdapter(adapter);  
                // myspinner.showAsDialog() <-- what i want             
                

                推荐答案

                你可以使用警告对话框

                    AlertDialog.Builder b = new Builder(this);
                    b.setTitle("Example");
                    String[] types = {"By Zip", "By Category"};
                    b.setItems(types, new OnClickListener() {
                
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                
                            dialog.dismiss();
                            switch(which){
                            case 0:
                                onZipRequested();
                                break;
                            case 1:
                                onCategoryRequested();
                                break;
                            }
                        }
                
                    });
                
                    b.show();
                

                当您想要按下其中一个时,这将关闭对话框.希望这会有所帮助!

                This will close the dialog when one of them is pressed like you are wanting. Hope this helps!

                这篇关于如何将 Android Spinner 创建为弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Android 对话框:删除标题栏 下一篇:是否可以在对话框内创建列表视图?

                相关文章

                最新文章

                • <bdo id='GRhQd'></bdo><ul id='GRhQd'></ul>
              2. <small id='GRhQd'></small><noframes id='GRhQd'>

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

                    <legend id='GRhQd'><style id='GRhQd'><dir id='GRhQd'><q id='GRhQd'></q></dir></style></legend>