用HBuilder
4.8.1.201412182433
重新建立项目做测试
首页(独立页)——app启动后进入的页面
第1页(独立页)——在首页点击用mui.openWindow方法打开
第2页(父页+子页)——在第1页点击用mui.openWindow方法打开
第3页(独立页)——在第2页的子页点击用mui.openWindow方法打开
使用webview的isVisible方法判断页面是否可见的状态,
测试过程和结果如下
1、启动app打开首页,后台打印如下:
> 页面数量1----------------------------------- at index.html:58
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at index.html:63
webview0的状态是:true at index.html:66
显示当前页面首页状态为true,可见。——正常。
2、点击首页,用mui.openWindow方法打开第1页,后台打印如下:
> 页面数量2----------------------------------- at app/page1.html:48
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page1.html:53
webview0的状态是:true at app/page1.html:56
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page1.html:53
webview1的状态是:false at app/page1.html:58
首页 webview0的状态是:true——不正常(这不是应该隐藏掉吗?)
第1页 webview1的状态是:false ——不正常(这不是当前显示的页面吗?)
3、点击第1页,用mui.openWindow方法打开第2页的父页+子页,后台打印如下:
>
页面数量3----------------------------------- at app/page2.html:46
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page2.html:51
webview0的状态是:true at app/page2.html:54
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page2.html:51
webview1的状态是:true at app/page2.html:54
webview2:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2.html at app/page2.html:51
webview2的状态是:false at app/page2.html:56
页面数量4----------------------------------- at app/page2-sub.html:45
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page2-sub.html:50
webview0的状态是:true at app/page2-sub.html:53
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page2-sub.html:50
webview1的状态是:true at app/page2-sub.html:53
webview2:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2.html at app/page2-sub.html:50
webview2的状态是:true at app/page2-sub.html:53
webview3:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2-sub.html at app/page2-sub.html:50
webview3的状态是:true at app/page2-sub.html:53
webview0的状态是:true ——不正常(当前不是应该隐藏不可见吗?)
webview1的状态是:true ——不正常(当前不是应该隐藏不可见吗?)
webview2的状态是:false——不正常(当前不是应该显示可见吗?)
当在第2页的子页面使用webview的isVisible方法判断页面是否可见的状态时候,
则全部显示true,这是怎么回事呢????????????????
4,当点击第2页的子页用用mui.openWindow方法打开第3页时候,后台显示:
>
页面数量5----------------------------------- at app/page3.html:41
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page3.html:45
webview0的状态是:true at app/page3.html:48
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page3.html:45
webview1的状态是:true at app/page3.html:48
webview2:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2.html at app/page3.html:45
webview2的状态是:true at app/page3.html:48
webview3:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2-sub.html at app/page3.html:45
webview3的状态是:true at app/page3.html:48
webview4:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page3.html at app/page3.html:45
webview4的状态是:false at app/page3.html:50
只有当前可见的webview4的状态是:false ,其他都为true,怎么全反过来了?
到底怎么回事吗?
7 个回复
DCloud_UNI_CHB
HBuilder 4.8.0之后,无需再手动隐藏旧页面,5+ runtime会自动处理;
潘歌 (作者) - 潘歌
开发测试过程总感觉流畅度有问题,实际打包后会比测试时候流畅度要好吗?
潘歌 (作者) - 潘歌
但我做了个测试,之前的页面还是显示状态的,导致打开的页面多了就卡啊卡
DCloud_App_Array
相同环境下打开很多页面的情况,如果隐藏了就不卡,不隐藏就会卡吗?
目前版本已经做了自动优化,如果窗口不可见(被其它窗口遮住),隐藏不会对性能产生影响。
如果确实出现了这种情况,请把两个应用发给我们并提供测试手机型号、系统版本等信息,我们好做定量分析问题。
潘歌 (作者) - 潘歌
会跟之前是使用4.8.0之前建立的工程有关系吗?呵呵,我重新建立再试试!
潘歌 (作者) - 潘歌
用HBuilder
4.8.1.201412182433
重新建立项目做测试
首页(独立页)——app启动后进入的页面
第1页(独立页)——在首页点击用mui.openWindow方法打开
第2页(父页+子页)——在第1页点击用mui.openWindow方法打开
第3页(独立页)——在第2页的子页点击用mui.openWindow方法打开
使用webview的isVisible方法判断页面是否可见的状态,
测试过程和结果如下
1、启动app打开首页,后台打印如下:
> 页面数量1----------------------------------- at index.html:58
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at index.html:63
webview0的状态是:true at index.html:66
显示当前页面首页状态为true,可见。——正常。
2、点击首页,用mui.openWindow方法打开第1页,后台打印如下:
> 页面数量2----------------------------------- at app/page1.html:48
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page1.html:53
webview0的状态是:true at app/page1.html:56
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page1.html:53
webview1的状态是:false at app/page1.html:58
首页 webview0的状态是:true——不正常(这不是应该隐藏掉吗?)
第1页 webview1的状态是:false ——不正常(这不是当前显示的页面吗?)
3、点击第1页,用mui.openWindow方法打开第2页的父页+子页,后台打印如下:
>
页面数量3----------------------------------- at app/page2.html:46
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page2.html:51
webview0的状态是:true at app/page2.html:54
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page2.html:51
webview1的状态是:true at app/page2.html:54
webview2:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2.html at app/page2.html:51
webview2的状态是:false at app/page2.html:56
页面数量4----------------------------------- at app/page2-sub.html:45
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page2-sub.html:50
webview0的状态是:true at app/page2-sub.html:53
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page2-sub.html:50
webview1的状态是:true at app/page2-sub.html:53
webview2:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2.html at app/page2-sub.html:50
webview2的状态是:true at app/page2-sub.html:53
webview3:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2-sub.html at app/page2-sub.html:50
webview3的状态是:true at app/page2-sub.html:53
webview0的状态是:true ——不正常(当前不是应该隐藏不可见吗?)
webview1的状态是:true ——不正常(当前不是应该隐藏不可见吗?)
webview2的状态是:false——不正常(当前不是应该显示可见吗?)
当在第2页的子页面使用webview的isVisible方法判断页面是否可见的状态时候,
则全部显示true,这是怎么回事呢????????????????
4,当点击第2页的子页用用mui.openWindow方法打开第3页时候,后台显示:
>
页面数量5----------------------------------- at app/page3.html:41
webview0:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/index.html at app/page3.html:45
webview0的状态是:true at app/page3.html:48
webview1:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page1.html at app/page3.html:45
webview1的状态是:true at app/page3.html:48
webview2:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2.html at app/page3.html:45
webview2的状态是:true at app/page3.html:48
webview3:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page2-sub.html at app/page3.html:45
webview3的状态是:true at app/page3.html:48
webview4:file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/app/page3.html at app/page3.html:45
webview4的状态是:false at app/page3.html:50
只有当前可见的webview4的状态是:false ,其他都为true,怎么全反过来了?
到底怎么回事吗?
DCloud_heavensoft
新版Android runtime虽然会自动释放不可见的webview的资源占用,但并不会改变webview的visible取值的。只有你手动hide和show,才会改变visible的值。
如果还是有问题,@DCloud_Android_磊子