你如何创建一个应用程序,只允许水平方向? [英] How do you create an app that only allows horizontal orientation?

查看:113
本文介绍了你如何创建一个应用程序,只允许水平方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在建立一个横向卷轴式的游戏,我最后一年的项目我的学位证书。

I'm currently creating a side-scroller style game for my final year project for my degree.

我只是想知道你是如何做设计的时候,手机是在水平方向显示,即使在手机保持在它的垂直方向的菜单?

I'm just wondering how you make the menu designed for when the phone is in horizontal orientation display, even when the phone is held in it's vertical orientation?

即。我希望用户知道游戏与手机在它的水平方向上进行播放,并且希望在菜单的仅在水平方向显示。

i.e. I want the user to know that the game has to be played with the phone in it's horizontal orientation and want the menu's to only display in the horizontal orientation.

在预先感谢。

推荐答案

添加以下属性到你的活动在你的Andr​​oidManifest.xml:

Add the following attribute to your activity in your AndroidManifest.xml:

<一个href="http://developer.android.com/guide/topics/manifest/activity-element.html#screen"><$c$c>android:screenOrientation="landscape"

这篇关于你如何创建一个应用程序,只允许水平方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆