Dialog 用代码来实现全屏

来源:互联网 发布:建网站的软件 编辑:程序博客网 时间:2024/05/21 11:27

实现代码如下

Window window = getWindow();        requestWindowFeature(Window.FEATURE_NO_TITLE);        if (window != null) {            window.getDecorView().setPadding(0, 0, 0, 0);            //很重要         window.setBackgroundDrawableResource(android.R.color.transparent);            WindowManager.LayoutParams params = window.getAttributes();            params.width = ViewGroup.LayoutParams.MATCH_PARENT;            params.height = ViewGroup.LayoutParams.MATCH_PARENT;            window.setAttributes(params);        }
原创粉丝点击