你怎么prevent被侧身Android的屏幕? [英] How do you prevent the android screen from being turned sideways?

查看:75
本文介绍了你怎么prevent被侧身Android的屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我打开设备侧身,一切都在我的应用程序也转身变得扭曲。我如何锁定它变成垂直?

Whenever I turn the device sideways, everything in my app also turns and becomes distorted. How do I lock it into vertical?

推荐答案

在你的的Andr​​oidManifest.xml 您的活动方向设置为纵向是这样的。

In your AndroidManifest.xml set the orientation on your Activity to portrait like this.

<activity android:name=".YourActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

这篇关于你怎么prevent被侧身Android的屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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