我想知道当我们旋转设备时,设备大约需要多长时间才能改变方向。在我的应用程序中,当我旋转手机设备时,旋转屏幕大约需要 1 到 2 秒。现在我的问题是,它是正常跨度还是延迟跨度。这样我就可以相应地处理它。
提前致谢。
我想知道当我们旋转设备时,设备大约需要多长时间才能改变方向。在我的应用程序中,当我旋转手机设备时,旋转屏幕大约需要 1 到 2 秒。现在我的问题是,它是正常跨度还是延迟跨度。这样我就可以相应地处理它。
提前致谢。
从一点代码研究来看,旋转视图似乎至少需要 200 毫秒。此延迟是为了确保设备方向的更改是有意的。
来自WindowOrientationListener.java的代码片段供参考:
// The number of milliseconds for which the device posture must be stable
// before we perform an orientation change. If the device appears to be rotating
// (being picked up, put down) then we keep waiting until it settles.
private static final int SETTLE_TIME_MIN_MS = 200;
android:configChanges="orientation|screenSize"
在清单文件中添加。例如
<activity
android:name="example.pangasinantranslator.MainActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>