您的位置:首页 > 编程语言

Dialog 用代码来实现全屏

2017-11-15 12:51 225 查看

实现代码如下

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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  dialog