Showing two ProgressDialog instead one

2019-08-15 02:44发布

问题:

When I use samsung galaxy mini 4.4 I see two progressDialog(picture below). When I use another device - everething is okay

if (progressDialog == null) {
        progressDialog = new ProgressDialog(getActivity(), R.style.AlertDialogThemeBlackColor);
        progressDialog.setMessage(getResources().getString(R.string.loading_your_data));
        progressDialog.setCancelable(false);
    }
    progressDialog.show();

回答1:

I didn't found reason, but I found a way to avoid this. Need to create a dialog in the following manner:

new ProgressDialog(new ContextThemeWrapper(getActivity(), R.style.ProgressDialog));

R.style.ProgressDialog - your theme



回答2:

I changed ProgressDialog's style from my custom style to Theme_AppCompat_Dialog

new ProgressDialog(mContext, R.style.Theme_AppCompat_Dialog)

This solved the issue, but couldn't find out the reason for the problem.