解决办法标签:居中,layoutParams,WindowManager,LayoutParams,window,dialog,article,小米 From: https://www.cnblogs.com/kinoyo/p/17078656.html
Window window =dialog.getWindow();
// window.setGravity(Gravity.CENTER);
WindowManager.LayoutParams layoutParams = window.getAttributes();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(layoutParams);
参考:https://article.itxueyuan.com/O0P9M
https://dandelioncloud.cn/article/details/1503805753193492481