简体   繁体   English

Phonegap暂时禁用横向模式

[英]Phonegap temporarily disable landscape mode

Im using Phonegap to create a game for Android. 我正在使用Phonegap创建适用于Android的游戏。 I've created a lobby to search for opponents and to chat with other players. 我创建了一个大厅来寻找对手并与其他玩家聊天。

When a player has found his opponent, he can play a game with him. 玩家找到对手后,便可以与他玩游戏。

My problem is that the lobby need to be portrait only and the game landscape only. 我的问题是,大厅仅需纵向放置,而游戏仅需横向放置。 My config.xml (phonegap) let me only disable one. 我的config.xml(phonegap)只允许我禁用一个。

Is there a way to temporarily disable one of the orientation modes in/with phonegap? 有没有一种方法可以在Phonegap中临时禁用其中一种定向模式?

There is this plugin from yoik which allows you to do that. yoik提供了这个插件,您可以执行此操作。 Basic usage (from documentation) 基本用法(来自文档)

// set to either landscape
screen.lockOrientation('landscape'); // Or portrait

// allow user rotate
screen.unlockOrientation();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM