My loading circle works fine but has a white box behind it as seen here. I have spent a few hours searching for solutions and all of the SO posts I've found suggest an implementation very similar to the one I've used. I also tried applying a custom theme to the dialog and setting transparency but this did nothing. I'm not sure what the white rectangle actually is since changing the properties of the ProgressBar itself only seems to affect the square in the center containing the image.
I have the following layout defined for my progress bar which runs during my AsyncTask.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/transparent" >
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"/>
</FrameLayout>
Below is my method for the dialog which uses the layout shown above.
public static ProgressDialog createProgressDialog(Context mContext) {
ProgressDialog dialog = new ProgressDialog(mContext);
try {
dialog.show();
} catch (WindowManager.BadTokenException e) {
}
dialog.setCancelable(false);
dialog.setContentView(R.layout.progressdialog);
return dialog;
}
public class FetchAcroTask extends AsyncTask<String, Void, String[]> {
Dialog progressDialog = null;
@Override
protected void onPreExecute() {
// Display loading circle
if (progressDialog == null) {
progressDialog = createProgressDialog(AcroActivity.this);
progressDialog.show();
} else {
progressDialog.show();
}
}
@Override
protected String[] doInBackground(String... params) {
if (params.length == 0) {
return null;
}
return GET(params[0]);
}
@Override
protected void onPostExecute(String[] resultStrs) {
if (resultStrs == null) {
acroAdapter.add("No results were found");
} else {
acroAdapter.addAll(resultStrs);
}
// Dismiss loading circle
progressDialog.dismiss();
}
}
}
Thanks in advance.