DialogFragment的宽高设置

作者: 小吉快跑呀 | 来源:发表于2017-11-29 20:35 被阅读0次

    方法一

    @Override
    public void onResume() {
        ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
        params.width = LayoutParams.MATCH_PARENT;
        params.height = LayoutParams.MATCH_PARENT;
        getDialog().getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
    
        super.onResume();
    }
    

    方法二

    @Override
    public void onResume() {
        getDialog().getWindow().setLayout(width, height);
        super.onResume();
    }
    
    

    相关文章

      网友评论

        本文标题:DialogFragment的宽高设置

        本文链接:https://www.haomeiwen.com/subject/mvvpbxtx.html