Android Dialog弹出xml

条件:GifView.jar

/**
* 弹出框
* @author  mickey
*/
public class DialogDeal
{
   
    private Dialog dlg;
   
    public void dialog(Context context)
    {
        dlg = new AlertDialog.Builder(context).create();
        dlg.show();
        dlg.getWindow().setContentView(R.layout.gif);
        LayoutInflater factory = LayoutInflater.from(context);
        View view = factory.inflate(R.layout.gif, null);
        GifView gifView = (GifView)view.findViewById(R.id.gif1);
        gifView.setGifImage(R.drawable.c);
        dlg.getWindow().setContentView(view);
    }
   
    public void dismiss()
    {
        this.dlg.dismiss();
    }
   
}

xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.ant.liao.GifView
android:id="@+id/gif1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:paddingRight="14px" android:enabled="false" />

</LinearLayout>

引用:
DialogDeal deal = new DialogDeal();
deal.dialog(context);
销毁:
deal.dismiss();

你可能感兴趣的:(dialog)