我该如何删除显示在进度对话框后面的空白对话框?

时间:2016-11-12 07:31:37

标签: android progressdialog

progress dialog box

我已经研究了很多关于它的但是找不到任何我应该使用异步任务进行我的进度对话框,或者是否可能因为super.show();而出现了重复的对话框。请参考上面的图片

以下是我的代码:

private ProgressDialog m_dialog = null;

if (m_dialog == null){
    m_dialog = new Dialog(...); // initiate it the way you need
    m_dialog.show();
} 
else if (!m_dialog.isShowing()){
    m_dialog.show();
}

1 个答案:

答案 0 :(得分:0)

使用关注链接Remove progress bar background in android progress bar 如果不是使用full plese制作自定义Progressbar 如下所示进行自定义AlertDialog

document.getElementById('id').onclick = function () { 
    alert("called");
}

或xml文件是

public static AlertDialog getAlertProgress(Activity mActivity)
{

    final AlertDialog alertDialog;
    final AlertDialog.Builder builder;

    LayoutInflater inflater = (LayoutInflater)mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View layout = inflater.inflate(R.layout.process_layout,null,false);

    AVLoadingIndicatorView avLoadingIndicatorView = (AVLoadingIndicatorView)layout.findViewById(R.id.progress_avi);

    avLoadingIndicatorView.show();
    builder = new AlertDialog.Builder(mActivity);

    builder.setView(layout);
    alertDialog = builder.create();
    alertDialog.setCancelable(false);
    alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return alertDialog;

}

或者你可以在你想要的地方或你想要的地方使用它。 如果使用

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:background="@android:color/transparent"
    >
//here i use the libery progress accordint to my project you can use progress bar here
    <com.wang.avi.AVLoadingIndicatorView
    android:background="@android:color/transparent"
    android:layout_centerInParent="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/progress_avi"
    android:visibility="visible"
    app:indicatorName="LineScaleIndicator"
    app:indicatorColor="@color/bagintero2"/>

</LinearLayout>

</RelativeLayout>

或当您想要解雇时

    Alertdialog alertdialog = Clasneme.getAlertprogress(activityName.this);
    alertdialog.show;