Android的屏幕方向的数据丢失prevention [英] Android screen orientation data lose prevention

查看:127
本文介绍了Android的屏幕方向的数据丢失prevention的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从每当用户翻转屏幕重置停止我的应用程序。我真的不希望它永久地设置为纵向。

I am trying to stop my app from resetting whenever the user flips the screen. I don't really want to set it to portrait permanently.

我的问题是我有擦除设置和每个屏幕翻转时间,这将停止服务。我想保持东西,因为他们无论屏幕方向。

My problem is I have settings which erase and a service which stops each time the screen flips. I would like to keep things as they are regardless of the screen orientation.

推荐答案

在你的Andr​​oidManifest的活动,设置如下:

On your Activity in your AndroidManifest, set the following:

<activity android:name="YourActivity" android:configChanges="orientation|keyboardHidden"></activity>

这告诉你的活动不要在屏幕上方向改变或键盘改变状态再制造本身

This tells your Activity to not "re-create" itself on screen orientation changes or keyboard change state

这篇关于Android的屏幕方向的数据丢失prevention的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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