HarmonyOS page跳转白屏

在调试中,发现page在跳转时,中间会有一个白屏过程,是否可以优化,让page过渡自然不闪屏。

HarmonyOS
2024-08-29 11:34:21
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple

在使用router.replaceUrl时应用内某个页面替换当前页面,并销毁被替换的页面。不支持设置页面转场动效,所以页面确实会出现短暂白屏效果,推荐伙伴使用Navigation组件进行页面跳转。参考链接为:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-navigation-navigation-0000001774120150,参考代码如下:

import { StartupPage } from './MainPage'; 
build() { 
  // Column() { 
  Navigation(){ 
    NavRouter(){ 
      // 第一张 
      Stack({ alignContent: Alignment.Center }) { 
        Image("").backgroundColor(Color.Black) 
          .width(CommonConstants.IMAGE_WIDTH) 
          .height(CommonConstants.IMAGE_HEIGHT) 
        AdvertiseIcon() 
      } 
      .height('100%') 
      // .width('100%') 
      .layoutWeight(CommonConstants.STACK_LAYOUT_WEIGHT) 
      .width(CommonConstants.STACK_WIDTH) 
      // 第二张图片 
      NavDestination() { 
        StartupPage() 
      } 
      .hideTitleBar(true) 
    } 
  } 
  .height('100%') 
  .width('100%') 
  .mode(NavigationMode.Stack) 
  .hideTitleBar(true) 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
分享
微博
QQ
微信
回复
2024-08-29 17:08:20
相关问题
HarmonyOS 跳转应用授权页面白屏
880浏览 • 1回复 待解决
HarmonyOS 多module中page跳转
650浏览 • 1回复 待解决
跳转设置页返回存在白屏
2598浏览 • 1回复 待解决
Page Ability 无法实现跳转
9854浏览 • 1回复 待解决
HarmonyOS web白屏
601浏览 • 1回复 待解决
HarmonyOS 系统地图白屏
708浏览 • 2回复 待解决
HarmonyOS webview显示白屏
1112浏览 • 1回复 待解决
HarmonyOS Web加载网页白屏
1372浏览 • 1回复 待解决
HarmonyOS webview加载url白屏
958浏览 • 1回复 待解决
HarmonyOS Web界面显示白屏
763浏览 • 1回复 待解决