HarmonyOS 应用启动会有一瞬间白屏,然后再进入启动页?

预期的话是点击完应用图标,直接就会进入应用的启动页,但是目前的情况是进启动页之前会有超级短暂的一瞬间的白屏,白屏中间还有个应用的图标

阅读 521
1 个回答

这是由应用的启动页面的背景颜色所决定的,默认为白色。

可以通过startWindowBackground字段设置启动页面的背景颜色。设置如下:

"module": {
  // ...
  "abilities": [
  {
    "name": "EntryAbility",// UIAbility组件的名称
  "srcEntrance": "./ets/entryability/EntryAbility.ts", // UIAbility组件的代码路径
  "description": "$string:EntryAbility_desc", // UIAbility组件的描述信息
  "icon": "$media: icon", // UIAbility组件的图标
  "label": "$string:EntryAbility_label", // UIAbility组件的标签
  "startWindowIcon": "$media: icon", // UIAbility组件启动页面图标资源文件的索引
  "startWindowBackground": "$color: start_window_background", // UIAbility组件启动页面背景颜色资源文件的索引
    //...
  }
  ]
}