dialog设置style
<!--Dialog 样式 四周没有边框 加 全屏时不会有隐藏标题栏-->
<style name="fullDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
activity中
private void setFullScreen2() {
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
this.getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}
dialog中
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(lp);
getWindow().setLayout(-1, -1);
setFullScreenUi();
private void setFullScreenUi(){
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_FULLSCREEN;
this.getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}