我试图使不确定的 Drawable 的背景透明,但它总是以灰色背景出现。
我在谷歌搜索了很多,但我找不到任何有用的答案。
这是我的代码:
活动代码:
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:(ProgressBar 和 TextView 在 LinearLayout 内,但这里不喜欢显示):
<?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>
动画列表(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>
谢谢您的帮助。