Android Dialog如何自定义设置宽度和高度

来源:互联网 发布:淘宝卖快排配件犯法吗 编辑:程序博客网 时间:2024/06/05 00:38

Builder mBuilder = new Builder(ctx);Dialog mAlert = mBuilder.create();mAlert.show();Window window = mAlert.getWindow();WindowManager.LayoutParams P = window.getAttributes();P.width = 自定义宽度(px);P.height = 自定义高度(px);window.setAttributes(P);window.setBackgroundDrawableResource(android.R.color.transparent);// 去掉dialog的默认背景mAlert.setContentView(contentView);


0 0
原创粉丝点击