Android的禁用风景模式 [英] Android disable landscape mode

查看:138
本文介绍了Android的禁用风景模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要禁用的横向视图在Android应用程序。我用:

 <活动机器人:名称=。SomeActivity
              机器人:标签=@字符串/ APP_NAME
              机器人:screenOrientation =画像>
 

它的工作原理,但有一个稍微大问题。如果我旋转屏幕的活动重新启动,而当它回来,屏幕仍处于纵向模式。我想我的应用程序完全忽略了设备的位置。有一个在禁用横向视图,如果当我旋转设备的活动没有重新启动点(屏幕变黑了几秒钟,然后将活动再次出现仍处于纵向模式)。

解决方案

 安卓configChanges =定位| keyboardHidden |键盘
 

I wish to disable the landscape view in an android application . I've used :

 <activity android:name=".SomeActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">

It works but there is a slightly big problem . If I rotate the screen the activity restarts , and when it comes back , the screen is still in portrait mode . I want my app to completely ignore the device's position . There is no point in disabling the landscape view if when I rotate the device the activity restarts ( the screen becomes black for a few seconds , and then the activity appears again still in portrait mode ) .

解决方案

android:configChanges="orientation|keyboardHidden|keyboard"

这篇关于Android的禁用风景模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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