2

i was trying to make the background of an indeterminate Drawable transparent but it always appears with a gray background.

I've searched a lot in google, but i couldn't find any useful answer.

Here is my code:

code on Activity:

    dialogo = new Dialog(this, R.style.Dialog);
    dialogo.getWindow().setBackgroundDrawable(new ColorDrawable(0));

    dialogo.setContentView(R.layout.dialog_progress);
    ProgressBar bar = (ProgressBar) dialogo.findViewById(R.id.imgProgreso);
    bar.setBackgroundColor(0x00000000);
    bar.setDrawingCacheBackgroundColor(0x00000000);
    bar.setBackgroundDrawable(null);
    dialogo.setTitle("Procesando...");

    TextView text = (TextView) dialogo
            .findViewById(R.id.txtmensajedialogprogress);
    text.setText("");

    dialogo.show();

dialog_progress.xml: (the ProgressBar and TextView are inside a LinearLayout, but it doesn't like to show here):

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="match_parent"
     android:background="@android:color/transparent"
     android:gravity="center"
     android:orientation="vertical" >
    <ProgressBar
      android:id="@+id/imgProgreso"
      android:layout_width="32dp"
      android:layout_height="32dp"
      android:layout_margin="5dip"
      android:background="@android:color/transparent"
      android:indeterminateDrawable="@drawable/waiting" />

    <TextView
      android:id="@+id/txtmensajedialogprogress"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal|center_vertical"
      android:background="@android:color/transparent"
      android:gravity="center_vertical|center_horizontal"
      android:text="Procesando la solicitud"
      android:textColor="@android:color/black"
      android:textSize="15dp"
      android:textStyle="normal" />
</LinearLayout>

Animation List (waiting.xml):

<?xml version="1.0" encoding="utf-8"?>
    <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/selected"
      android:oneshot="false" >
       <item android:drawable="@drawable/big_load00000" android:duration="50" />
           <item android:drawable="@drawable/big_load00001" android:duration="50" />
           <item android:drawable="@drawable/big_load00002" android:duration="50" />
           <item android:drawable="@drawable/big_load00003" android:duration="50" />
           <item android:drawable="@drawable/big_load00004" android:duration="50" />
           <item android:drawable="@drawable/big_load00005" android:duration="50" />
           <item android:drawable="@drawable/big_load00006" android:duration="50" />
           <item android:drawable="@drawable/big_load00007" android:duration="50" />
           <item android:drawable="@drawable/big_load00008" android:duration="50" />
           <item android:drawable="@drawable/big_load00009" android:duration="50" />
           <item android:drawable="@drawable/big_load00010" android:duration="50" />
           <item android:drawable="@drawable/big_load00011" android:duration="50" />
    </animation-list>

Thank you for your help.

  • I am not sure about this but, 0x00000000 makes it fully transparent and then you will see actual background. – Milan Jun 20 '13 at 01:42
  • Yes, but if it worked, i could see the background of the app, but it is showing that gray background surrounding only the animation. – Giovanny Velez Jun 20 '13 at 02:31
  • I think I've got a similar question here: http://stackoverflow.com/questions/16978377/removing-the-background-of-a-frame-animation-in-android – marienke Jun 26 '13 at 14:15
  • I've got the same question, using animation-list to show the progress wheel. But could not set background transparent. – Mike Hung Aug 13 '14 at 09:08

0 Answers0