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

          <bdo id='MqMSh'></bdo><ul id='MqMSh'></ul>
      1. <tfoot id='MqMSh'></tfoot>

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

        单击中性按钮后是否可以保持对话框打开?

        Is it possible to keep a Dialog open after clicking the Neutral Button?(单击中性按钮后是否可以保持对话框打开?)
      3. <tfoot id='MvHb0'></tfoot>

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

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

                  <tbody id='MvHb0'></tbody>

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

                • 本文介绍了单击中性按钮后是否可以保持对话框打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个包含 3 个 EditText 的对话框,用于获取 ftp 地址、用户名和密码.我使用 .setNeutralButton 创建了一个测试连接"按钮.我让它连接到 ftp 并显示一个带有结果的 Toast,但我不希望测试按钮关闭对话框.如何在连接测试期间保持对话框打开?

                  I have a Dialog with 3 EditTexts that I use to get an ftp address, username, and password. I used .setNeutralButton to create a button to "Test Connection". I got it working to connect to the ftp and show a Toast with the result but I don't want the Test Button to close the Dialog. How can I keep the Dialog open during the connection test?

                  livePreviewChk.setOnClickListener(new OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          LinearLayout lila1 = new LinearLayout(NewSite.this);
                          lila1.setOrientation(1); // 1 is for vertical orientation
                  
                          final EditText serverName = new EditText(NewSite.this);
                          serverName.setHint("Server name");
                  
                          final EditText serverAddress = new EditText(NewSite.this);
                          serverAddress.setHint("Server Address");
                  
                          final EditText username = new EditText(NewSite.this);
                          username.setHint("Username:");
                  
                          final EditText password = new EditText(NewSite.this);
                          password.setHint("Password");
                  
                          AlertDialog.Builder alt_bld = new AlertDialog.Builder(
                                  NewSite.this);
                          alt_bld.setIcon(R.drawable.ftpicon);
                          alt_bld.setTitle("Enter the login details for the host FTP")
                                  .setCancelable(true)
                                  .setPositiveButton("Save",
                                          new DialogInterface.OnClickListener() {
                                              public void onClick(DialogInterface dialog,
                                                      int id) {
                                                  }
                                              }
                                          })
                                  .setNeutralButton("Test Connection",
                                          new DialogInterface.OnClickListener() {
                                              public void onClick(DialogInterface dialog,
                                                      int id) {
                                                  FTPConnector testConnection = new FTPConnector();
                                                  boolean status = testConnection
                                                          .ftpConnect(host, user, pass,
                                                                  port);
                                                  if (status == true) {
                                                      connectionSuccessfull = true;
                                                  } else {
                                                      connectionSuccessfull = false;
                                                  }
                                              }
                                          })
                                  .setNegativeButton("Cancel",
                                          new DialogInterface.OnClickListener() {
                                              public void onClick(DialogInterface dialog,
                                                      int id) {
                                                  // if this button is clicked, just close
                                                  // the dialog box and do nothing
                                                  dialog.cancel();
                                              }
                                          });
                  
                          lila1.addView(serverName);
                          lila1.addView(serverAddress);
                          lila1.addView(username);
                          lila1.addView(password);
                  
                          AlertDialog alert = alt_bld.create();
                          alert.setView(lila1);
                          alert.show();
                      }
                  });
                  

                  推荐答案

                  据我所知,不扩展 Dialog 类是不可能的.但是,使用您拥有的功能,将其放在自己的 Activity 中并使用 Dialog 主题 可能会更容易和更好.您所要做的就是为此将您的代码放入一个新的 Activity 中,并在您的 manifest 中使用 dialog 主题

                  From what I know, it is not possible without extending the Dialog class. However, with the functionality that you have it may be easier and better just to put it in its own Activity and use a Dialog theme. All you have to do is put your code into a new Activity for this and in your manifest use the dialog theme

                  <activity
                          android:name="com.your.package.YourClassName"
                          android:label="YOurLabel"
                          android:theme="@android:style/Theme.Dialog" >
                  </activity>
                  

                  这将提供 Dialog 的外观和感觉,同时包含在它自己的 Activity

                  This will give the look and feel of a Dialog while being contained in its own Activity

                  这是一个 关于扩展对话框的答案.我还没有看透这一切,但看起来如果你选择这个选项,它可能会给你你需要的东西.

                  Here is a SO answer on extending Dialog. I haven't looked through it all but looks like it may give you what you need if you choose this option.

                  这篇关于单击中性按钮后是否可以保持对话框打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                • <legend id='WzO7u'><style id='WzO7u'><dir id='WzO7u'><q id='WzO7u'></q></dir></style></legend><tfoot id='WzO7u'></tfoot>

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

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