package com.prws.common.view; import android.app.Dialog; import android.content.Context; import android.view.Window; import android.view.WindowManager; /** * @author zhiqun.tang * @Description: * @date 2022/9/26 */ public class DialogView extends Dialog { public DialogView(Context mContext, int layout, int style, int gravity) { super(mContext, style); setContentView(layout); Window window = getWindow(); WindowManager.LayoutParams layoutParams = window.getAttributes(); layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT; layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; layoutParams.gravity = gravity; window.setAttributes(layoutParams); } }