安卓爬坑指南之沉浸式状态栏下PopupWindow、Dialog全屏显示

PopupWindow 全屏显示

pop.setClippingEnabled(false)

Dialog沉浸式显示

//设置全屏
        getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
//设置dialog沉浸式效果
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
posted @ 2021-10-14 14:20  似水流云  阅读(1370)  评论(0编辑  收藏  举报