我想显示自定义对话框,如iphone hud进度条样式。但是,我不知道如何在Android上创建像iphone等hud进度条的自定义对话框。
我想要如下图所示的自定义对话框:
帮帮我......!
谢谢...!
答案 0 :(得分:21)
我创建了一个示例Android应用程序和一个ProgressHUD类,您可以将其用于此目的。你可以在这里找到它: https://github.com/anupamdhanuka/AndroidProgressHUD
答案 1 :(得分:1)
看看这个(我的)库。 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();
final IOSDialog dialog0 = new IOSDialog.Builder(IOSDialogActivity.this)
.setTitle("Default IOS bar")
.setTitleColorRes(R.color.gray)
.build();
结果:标准IOS对话
答案 2 :(得分:-1)
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();
}
}
}
执行asynctask
Loadassync mAssyn1 = new LoadAssync();
mAssyn1.execute();