QML 屏幕方向锁定 [英] QML screen orientation lock
本文介绍了QML 屏幕方向锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将屏幕锁定到我正在制作的 Android 应用程序的特定方向.有没有办法在 QML 中做到这一点?谷歌没有给我任何答案.
我正在使用 Qt 5.2.
I need to lock the screen to a specific orientation for an android app that I'm making.
is there a way to do that in QML? Google didn't get me any answers.
I am using Qt 5.2.
推荐答案
你基本上可以使用 Screen.orientation
属性进行只读.详情请看下面的例子:
You can basically use the Screen.orientation
property for reading only. See the following example for details:
http://qt-project.org/doc/qt-5/qtquick-window-screeninfo-qml.html
到目前为止,正确的方法是使用 Android 清单文件,就像 Digia 的 Qt Android 开发人员为他的 QtHangMan 游戏 即:
The proper way as of today is to use the Android manifest file for this as done by the Qt Android developer at Digia for his QtHangMan game which is:
<activity android:screenOrientation="portrait" ...
这篇关于QML 屏幕方向锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文