Dialogfragment的使用

1.创建自己的类并继承DialogFragment类。(和Fragment使用差不多)

2.dialogfragment df=new dialogfragment();//实例化自己的创建的类
            df.show(getFragmentManager(), "dialogfragment");//show出dialog
            df.setCancelable(false);//
设置点击dialog以外是否消失,false不消失,ture消失



3.去掉标题栏,在oncreatview方法中

getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);



4.设置dialog的宽高。

在继承DialogFragment 的类的public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        getDialog().getWindow().setLayout(600, 600);//设置宽高。
    }

你可能感兴趣的:(Dialogfragment的使用)