鸿蒙初学 隐藏/显示状态栏和改变导航栏的颜色(Harmony First Learning: Hide / Show the Status Bar and Change the Color of.)

隐藏状态栏: 全屏显示

getWindow().addFlags(WindowManager.LayoutConfig.MARK_FULL_SCREEN);

显示状态栏: 移除全屏显示的Flags

getWindow().clearFlags(WindowManager.LayoutConfig.MARK_FULL_SCREEN);

改变导航栏的颜色

getWindow().setNavigationBarColor(Color.BLACK.getValue());

效果图:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_41359651/article/details/119576779