【问题标题】:how to convert current screen to landscape mode in phoneGap如何在phoneGap中将当前屏幕转换为横向模式
【发布时间】:2015-05-06 05:40:05
【问题描述】:

我们正在开发 phone-gap 应用程序。我们有 4 个页面,例如 one.html,two.html,three.html,four.html。在这一个(two.html)的 HTML 文件中需要自动横向模式.

请指导我们。我们是新手。

【问题讨论】:

    标签: javascript jquery cordova jquery-mobile landscape


    【解决方案1】:

    先添加这个脚本

    <script type="text/javascript" src="cordova.js"></script>
    

    然后在另一个脚本标签内

    <script>
        document.addEventListener("deviceready", onDeviceReady, false);
        function onDeviceReady() {
            var so = cordova.plugins.screenorientation;
            so.setOrientation(so.Orientation.LANDSCAPE);
        }
    </script>
    

    【讨论】:

      【解决方案2】:

      您可以使用适用于 Android 的 Screen Orientation PhoneGap 插件

      以下是链接。

      https://github.com/their/pg-plugin-screen-orientation

      【讨论】:

      • 我们尝试了链接,但我们没有运气请告诉我它的放置位置 navigator.screenOrientation.set('landscape');
      猜你喜欢
      • 2014-07-01
      • 2011-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-30
      • 1970-01-01
      • 2020-06-02
      • 1970-01-01
      相关资源
      最近更新 更多