【问题标题】:I Want Show Custom Dialog like iphone HUD Progress Bar我想显示自定义对话框,如 iphone HUD 进度条
【发布时间】:2017-12-29 16:10:40
【问题描述】:

我想显示像 iphone hud 进度条样式这样的自定义对话框。但是,我不知道要在 android 上创建像 iphone 那样的 hud 进度条这样的自定义对话框。

我想要如下图所示的自定义对话框:

帮帮我...!

谢谢...!

【问题讨论】:

  • 首先,每个平台都有自己的 UI 和编程标准

标签: android


【解决方案1】:

我创建了一个示例 Android 应用程序和一个 ProgressHUD 类,您可以将其用于此目的。你可以在这里找到它: https://github.com/anupamdhanuka/AndroidProgressHUD

【讨论】:

    【解决方案2】:

    看看这个(我的)图书馆。 IOSDialog/Spinner library

    它非常易于使用并解决了您的问题。有了它,您可以像在 IOS 中一样轻松创建和使用微调器。 代码示例:

    final IOSDialog dialog1 = new IOSDialog.Builder(IOSDialogActivity.this)
                .setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        dialog0.show();
                    }
                })
                .setDimAmount(3)
                .setSpinnerColorRes(R.color.colorGreen)
                .setMessageColorRes(R.color.colorAccent)
                .setTitle(R.string.standard_title)
                .setTitleColorRes(R.color.colorPrimary)
                .setMessageContent("My message")
                .setCancelable(true)
                .setMessageContentGravity(Gravity.END)
                .build();
    

    Result

     final IOSDialog dialog0 = new IOSDialog.Builder(IOSDialogActivity.this)
                .setTitle("Default IOS bar")
                .setTitleColorRes(R.color.gray)
                .build();
    

    结果:标准 IOS 对话框

    【讨论】:

    • @ArtjomB。感谢您的建议。我表示这是我的图书馆。并且附上图片,但由于本人名气不大,只能留个链接。
    • 链接很好,因为图片很大而且有点分散注意力。
    【解决方案3】:
           private class loadassync extends
            AsyncTask<String, Void, Void> {
    
        private final ProgressDialog dialog = new ProgressDialog(
                classname.this);
    
        protected void onPreExecute() {
    
            this.dialog.setMessage("loading.....");
            this.dialog.show();
        }
    
        protected Void doInBackground(final String... args) {
    
            //add the logic while loading
        }
    
        protected void onPostExecute(final Void unused) {
    
            try {
                //add the logic after loading
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            if (this.dialog.isShowing()) {
                this.dialog.dismiss();
            }
    
        }
    }
    

    执行异步任务

         Loadassync mAssyn1 = new LoadAssync();
                    mAssyn1.execute();
    

    【讨论】:

      猜你喜欢
      • 2012-01-14
      • 2017-11-16
      • 1970-01-01
      • 2017-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-08
      相关资源
      最近更新 更多