[英]Android - “onConfigurationChanged()” not called when switching to same orientation (i.e landscape to reverse landscape))
I have this in my manifest: 我的清单中有这个:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.apps.foo.bar" >
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainPreviewActivity"
android:label="@string/app_name"
android:screenOrientation="fullSensor"
android:configChanges="orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Now the problem is here: 现在的问题是:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
.............
.................
............
}
This is being called fine when I rotate the screen from portrait to landscape. 当我将屏幕从纵向旋转到横向时,这被称为正常。 But once I am in landscape, if I turn to the other landscape (ie 180 degrees) it is not firing. 但是一旦我在风景中,如果我转向另一个风景(即180度),它就不会发射。 The strange thing is that it fires only from portrait
to landscape
and landscape
to portrait
. 奇怪的是,它只从portrait
到landscape
,从landscape
到portrait
才会发射。
Flipping from landscape to reverse landscape is not a configuration change as it is invisible to the environment the app is in and hence the system does not send an event. 从横向翻转到反向横向不是配置更改,因为它对应用程序所处的环境是不可见的,因此系统不会发送事件。
You can find more information and alternate solutions here: https://groups.google.com/forum/#!topic/android-developers/IgBNQNgFUmk 您可以在此处找到更多信息和备用解决方案: https : //groups.google.com/forum/#!topic / installer -developers /IgBNQNgFUmk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.