标签:
在这篇文章中,我们将介绍如何固定一个Ubuntu应用的方向。固定应用的方向对有些游戏应用来说,非常有用。这样可以让游戏专注于一个方向的布局,比如开车的游戏!
在Ubuntu应用中,我们可以通过如下的flag:
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
// Note! applicationName needs to match the "name" field of the click manifest
applicationName: "usermetrics.liu-xiao-guo"
/*
This property enables the application to change orientation
when the device is rotated. The default is false.
*/
//automaticOrientation: true
// Removes the old toolbar and enables new features of the new header.
useDeprecatedToolbar: false
width: units.gu(60)
height: units.gu(85)
...
}
目前我发现一个更加简单的办法,就是直接修改项目的.desktop文件:
[Desktop Entry] Name=fixedorientationapp Exec=qmlscene $@ Main.qml Icon=fixedorientationapp.png Terminal=false Type=Application X-Ubuntu-Touch=true X-Ubuntu-Supported-Orientations=landscape
当我们把项目的.desktop文件修改为:
[Desktop Entry] Name=fixedorientationapp Exec=qmlscene $@ Main.qml Icon=fixedorientationapp.png Terminal=false Type=Application X-Ubuntu-Touch=true X-Ubuntu-Supported-Orientations=portrait
整个应用的代码: git clone https://gitcafe.com/ubuntu/fixedorientationapp.git
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/ubuntutouch/article/details/48053233