这篇很有用:玩转HarmonyOS 状态栏&标题栏&导航栏相关操作方法整理
配置页面全屏显示(在config.json中配置):
"metaData": {"customizeData": [{"name": "hwc-theme","value": "androidhwext:style/Theme.Emui.Wallpaper.NoTitleBar.Fullscreen"}]
}
配置页面NoTitleBar显示(在config.json中配置):
"metaData": {"customizeData": [{"name": "hwc-theme","value": "androidhwext:style/Theme.Emui.Light.NoTitleBar"}]
}
标题栏、状态栏、导航栏的设置
更改系统标题栏的样式,在entry模块下的config.json文件添加配置(如下代码,无标题栏)。
1、在module下配置是改变应用的样式(在 metaData节点中配置);
2、abilities下配置是改变对应的页面样式。
{"name": "com.x.honet.LoginAbility","description": "$string:loginability_description","icon": "$media:icon","label": "$string:pro_honet_LoginAbility","launchType": "standard","orientation": "unspecified","type": "page","metaData": {"customizeData": [{"name": "hwc-theme","value": "androidhwext:style/Theme.Emui.Dark.NoActionBar"}]}}
"name": "hwc-theme"(固定写法,不能更改)
"value": "androidhwext:style/Theme.Emui.Light"(白色样式:有标题栏,状态栏和导航栏:字体颜色黑色)
"value": "androidhwext:style/Theme.Emui.Light.NoTitleBar"(白色样式:无标题栏,状态栏和导航栏:字体颜色黑色)
"value": "androidhwext:style/Theme.Emui.Dark"(黑色样式:有标题栏,状态栏和导航栏:字体颜色白色)
"value": "androidhwext:style/Theme.Emui.Dark.NoActionBar"(黑色样式:无标题栏,状态栏和导航栏:字体颜色白色)
参考:华为开发者博客
参考:文档中心