HarmonyOS 深色模式下,应用页面的时间、电量等信息展示?

如题:HarmonyOS 深色模式下,应用页面的时间、电量等信息展示?

阅读 516
1 个回答

深色模式下可以将状态栏的颜色修改一下

在onWindowStageCreate方法中,判断是否是深色模式,如果是的话,则使用以下代码:

windowStage.getMainWindow((e,w)=>{
  let t=w.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM);
  AppStorage.setOrCreate<window.AvoidArea>(eHomeApp.AVOID_AREA,t);

  let systemBarProperties: window.SystemBarProperties = {
    isStatusBarLightIcon: true,
    statusBarContentColor: '#ffffff'
  }
  w.setWindowSystemBarProperties(systemBarProperties)
})
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进