android DialogFragment底部弹出,自定义大小

public class Dlg extends DialogFragment {


    private View rootView;
    private int height;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        getDialog().getWindow().setGravity(Gravity.BOTTOM);//Dialog处于页面的底部
        getDialog().setCanceledOnTouchOutside(true);//点击Dialog外围可以消除Dialog
        height = (int) (SysUtil.getScreenHeight(getActivity()) * 0.65);//DLG高度
        getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,height);//设置高宽
        rootView=inflater.inflate(R.layout.dlg_product_item, null);
        ButterKnife.bind(this, rootView);
        return rootView;
    }


    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        setStyle(DialogFragment.STYLE_NORMAL, R.style.dialog_fragment);
        super.onCreate(savedInstanceState);
    }

}



   


   

dialog_in_bottom文件

            android:fromYDelta="100%p" android:toYDelta="0%p"
        android:duration="600"/>
   


dialog_out_bottom文件

   
            android:fromYDelta="0%p" android:toYDelta="100%p"
        android:duration="600"/>
   

你可能感兴趣的:(android)