Cordova/Phonegap:WP8.1导航栏重叠 [英] Cordova/Phonegap: WP8.1 Navbar overlapping

查看:63
本文介绍了Cordova/Phonegap:WP8.1导航栏重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的cordova应用程序是为WP 8.0 Target构建的. 当在没有硬件按钮而是可切换导航栏的WP8.1设备上运行它时,导航栏会覆盖HTML内容.隐藏导航栏时,导航栏的黑色背景保持不变,并且仍与HTML重叠.也可以滚动整个Web视图,以便我可以看到重叠的内容以及Web视图的内容.

My cordova application is built for WP 8.0 Target. When running it on a WP8.1 device that doesn't have hardware buttons but a toggleable navbar instead, the HTML content is overlapped by the navbar. When hiding the navbar, the black background of the navbar stays and still overlaps the HTML. It is also possible to scroll the entire webview so i can see the overlapped content as well as the content of the webview.

是否可以防止这种重叠或阻止整个Web视图的滚动?

Is it possible to prevent this overlapping or prevent the scrolling of the entire webview?

推荐答案

我遇到了完全相同的问题.这可能会在具有功能键的设备上的Windows Phone 8.1上发生,因为cordova Web视图被拉伸到屏幕的整个高度,因此它出现在功能键/导航栏的后面.

I've had exactly the same problem. This can happen on windows phone 8.1 on devices with softkeys as the cordova web view is stretched to the full height of the screen, consequently it appears behind the softkeys/navbar.

无法使用JavaScript检测到导航栏的存在或高度,并且因为Cordova似乎是为Windows Phone 8而不是8.1(我正在使用的至少为4.3)编写的,甚至无法访问到更新的8.1 ​​API,使其能够对导航栏做出反应.

It's not possible to detect with JavaScript the presence or height of the navbar and, as cordova seems to be written for windows phone 8 not 8.1 (at least 4.3 is which is what I'm using) it doesn't even access to the newer 8.1 API that would allow it to react to the navbar.

为此,我为我的应用程序编写了一个Cordova插件来处理此问题.启动应用程序时,它将自动调整Web视图的大小,以考虑导航栏/软键.如果用户通过从底部向上滑动来切换它,或者如果用户将手机旋转到横向,则它还将调整导航栏/软键周围的网络视图的大小(其中导航栏/软键显示在右/左,而不是底部)

To that end I've written a Cordova plugin for my app to deal with this. It automatically resizes the web view when the app launches to take the navbar/soft keys into account. It will also resize the web view around the navbar/soft keys if the user toggles it by swiping up from the bottom or if the user rotates the phone to landscape (where the navbar/soft keys appear on the right/left, rather than the bottom)

您还可以添加一个事件侦听器,该事件侦听器在软键/导航栏更改时将触发,它将向您发送高度.

You can also add an event listener which is fired when the soft keys/navbar changes, it will send you the height.

我只测试了我的应用程序,但希望它对您有用.

I've only tested it my app but I hope it works for you.

https://github.com/taroquu/CordovaNavbarPlugin

这篇关于Cordova/Phonegap:WP8.1导航栏重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆