views:

820

answers:

2

Hi,

i would like to show a modal progress "wheel" overlay on my view.

The ProgressDialog comes closs, but i do not want the dialog background or border.

i tried setting the background drawable of the dialog window:

this.progressDialog = new ProgressDialog(Main.this);

this.progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
this.progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
this.progressDialog.setCancelable(false);
this.progressDialog.setIndeterminate(true);

this.progressDialog.show();

but to no avail (i.e. still looks the same as without the ...setBackgroundDrawable code).

Any advice please? TIA!

+1  A: 

Have you checked out this tutorial? At the end of the page it talks about how to create a custom dialog, and that might help you put a spinner progress dialog box with your own backgrounds.

Steve H
+2  A: 

Hi,

Not sure if there is a better way, but you could get the spinner wheel on its own by using a ProgressBar and setting it to be interdeterminate. If you are using an AbsoluteLayout you can put it over other views. This layout should demonstrate this method with XML:

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout android:id="@+id/AbsoluteLayout"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    <ProgressBar android:id="@+id/ProgressBar"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:indeterminate="true" android:indeterminateOnly="true"
        android:isScrollContainer="true" android:layout_x="100dip"
        android:layout_y="10dip" android:soundEffectsEnabled="true"></ProgressBar>
    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:text="@string/hello"
        android:layout_gravity="center_horizontal" android:gravity="center_horizontal"
        android:layout_y="25dip" />
</AbsoluteLayout>
Klarth
Thanks, i'm sure this would work as well, so i've voted up, but i went for the other solution as it was simpler to implement.
Edwin Lee