xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
<ProgressBar android:id="@+id/progressBar1"
android:layout_width="wrap_content" android:layout_height="wrap_content"></ProgressBar>
<TextView android:layout_width="wrap_content" android:layout_marginTop="10dip"
android:layout_below="@+id/progressBar1" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:id="@+id/textView1"
android:text="Loading...."></TextView>
</RelativeLayout>
public void dialogProgrees(Context context)
{
dlg = new AlertDialog.Builder(context).create();
dlg.show();
dlg.getWindow().setContentView(R.layout.giftwo);
LayoutInflater factory = LayoutInflater.from(context);
View view = factory.inflate(R.layout.giftwo, null);
dlg.getWindow().setContentView(view);
}
public void dismiss()
{
this.dlg.dismiss();
}
引用:
DialogDeal deal = new DialogDeal();
deal.dialogProgrees(this);
销毁:
deal.dismiss();
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
<ProgressBar android:id="@+id/progressBar1"
android:layout_width="wrap_content" android:layout_height="wrap_content"></ProgressBar>
<TextView android:layout_width="wrap_content" android:layout_marginTop="10dip"
android:layout_below="@+id/progressBar1" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:id="@+id/textView1"
android:text="Loading...."></TextView>
</RelativeLayout>
public void dialogProgrees(Context context)
{
dlg = new AlertDialog.Builder(context).create();
dlg.show();
dlg.getWindow().setContentView(R.layout.giftwo);
LayoutInflater factory = LayoutInflater.from(context);
View view = factory.inflate(R.layout.giftwo, null);
dlg.getWindow().setContentView(view);
}
public void dismiss()
{
this.dlg.dismiss();
}
引用:
DialogDeal deal = new DialogDeal();
deal.dialogProgrees(this);
销毁:
deal.dismiss();