admin管理员组文章数量:1392081
I'm using the cordova-plugin-screen-orientation
plugin and have followed all of the instructions I can find for locking orientation and nothing is working. I'm running the application in Android Studio emulator and my Pixel phone.
In config.xml
I have no mention of orientation.
In index.js I have
function onDeviceReady() {
//not great but it's good enough for me
var isPhone = screen.height < 800 || screen.width < 800;
if (isPhone == false) {
// Lock to landscape for tablets
screen.orientation.lock('landscape-primary');
} else {
// Lock to portrait for phones
screen.orientation.lock('portrait-primary');
}
}
document.addEventListener('deviceready', onDeviceReady);
I also tried placing the JS in the HTML at the bottom. What am I doing wrong?
本文标签: androidSet orientation to landscape for tabletsportrait for phonesStack Overflow
版权声明:本文标题:android - Set orientation to landscape for tablets, portrait for phones - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744781828a2624760.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论