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:

android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

android:id="@+id/gif1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:paddingRight="14px" android:enabled="false" />



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

你可能感兴趣的:(andriod)