Dialog 用代码来实现全屏

版权声明:本文为博主原创文章,转载必须注明出处!! https://blog.csdn.net/qq_34902522/article/details/78539556

实现代码如下

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);
        }

猜你喜欢

转载自blog.csdn.net/qq_34902522/article/details/78539556
今日推荐