【问题标题】:How should i remove the blank dialog showing behind my progress dialog?我应该如何删除显示在我的进度对话框后面的空白对话框?
【发布时间】:2016-11-12 07:31:36
【问题描述】:

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();
}

【问题讨论】:

    标签: android progressdialog


    【解决方案1】:

    使用跟随链接Remove progress bar background in android progress bar 如果它不使用完整请制作自定义进度条 如下制作自定义的AlertDialog

    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;
    
    }
    

    或xml文件是

    <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>
    

    或者你可以在你想要的地方或当你想要的时候使用它.. 使用 if do

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

    或者当你想解雇时

           alertdialog.dismiss;
    

    【讨论】:

    • 您可以使用带有右侧文本的进度条,这应该比尝试删除 ProgressDialog 后面的背景更好
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-16
    • 2012-01-14
    • 1970-01-01
    相关资源
    最近更新 更多