很简单
主题 :
<style name="dialog_full_screen_style"> <item name="android:windowBackground">@null</item> <item name="android:windowFullscreen">true</item> </style>
然后设置之后你会发现,距离屏幕左右还有一部分间距,所以还要动态设置宽高
private void setDialogHeightAndWidth(Dialog dialog) { WindowManager.LayoutParams lay = dialog.getWindow().getAttributes(); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); Rect rect = new Rect(); View view = getWindow().getDecorView();//decorView是window中的最顶层view,可以从window中获取到decorView view.getWindowVisibleDisplayFrame(rect); lay.height = dm.heightPixels - rect.top; lay.width = dm.widthPixels; dialog.getWindow().setAttributes(lay); }