本文介绍了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公司为他的是:
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屏幕方向锁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!