prevent打开应用程序和方向改变时,动态壁纸取向的变化? [英] Prevent Live Wallpaper orientation change when an application is opened and orientation is changed?

查看:142
本文介绍了prevent打开应用程序和方向改变时,动态壁纸取向的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个定位问题,一个动态壁纸是我写的。基本上画布将轮流取决于它上面打开的应用程序。我测试了这一点,并意识到,当我返回到主屏幕从previously打开的应用程序是谁的取向改变了onSurfaceChanged()方法烧制。

I'm having an orientation issue with a Live Wallpaper that I wrote. Basically the canvas will rotate depending on the application opened above it. I tested this and realized that the onSurfaceChanged() method is firing when I return to the home screen from a previously opened application who's orientation was changed.

我想一个更好的问题是,为什么我的动态壁纸表面变化的应用程序打开时,它的方向变化?有没有一种方法,以prevent我从不断动态壁纸方向有什么变化?谢谢,希望是有道理的?

I suppose a better question would be, why does my Live Wallpaper Surface Change when an application is opened and it's orientation changed? Is there a way to prevent my Live Wallpaper orientation from ever changing? Thanks, hope that makes sense?

推荐答案

Android应用程序重新启动该活动的方向改变时。 您可以使用

Android application restarts the activity when the orientation changes. You can either use

  1. 机器人:configChanges 在你的清单。该活动被关闭,在默认情况下重新启动,当配置更改在运行时发生,但在宣布的配置与此属性将prevent活动被重新启动。相反,活动仍然运行和 onConfigurationChanged()方法被调用。
  2. 使用机器人:screenOrientatin =人像风景这将迫使应用程序到您指定的模式下运行。然而,它不会prevent从活动被关闭并重新启动。
  1. android:configChanges in your manifest. The activity is shut down and restarted by default, when a configuration change occurs at runtime, but declaring a configuration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called.
  2. use android:screenOrientatin = "portrait" or "landscape" it will force the app to run in the mode you specify. However it will not prevent the activity from being shut down and restarted.

这篇关于prevent打开应用程序和方向改变时,动态壁纸取向的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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