android - 方向更改默认时间延迟...?

标签 android android-layout android-orientation

我想知道当我们旋转设备时,它大约需要多长时间才能改变方向。在我的应用程序中,当我旋转手机设备时,旋转屏幕大约需要 1 到 2 秒。现在我的问题是,它是正常跨度还是延迟跨度。这样我就可以相应地进行处理。

提前致谢。

最佳答案

通过一些代码研究,看起来旋转 View 至少需要 200 毫秒。这种延迟是为了确保设备方向的改变是有意的。

来自 WindowOrientationListener.java 的代码 fragment 供引用:

// 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 - 方向更改默认时间延迟...?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6937746/

相关文章:

android - 如何让 AWS Cognito 登录/注销与 Android 上的 AWS API Gateway 正常配合使用?

android - 各个方向的应用程序

android - 屏幕方向横向颠倒 - 为什么?

java - 无法锁定方向;可能的修复?

带有文本刷新的 ANDROID 警报对话框

java - 我如何使用 TextView 修复 AsyncTask 错误

java - Genymotion 与不同本地子网中的套接字通信

java - 自定义组件未在 Android Studio 的编辑模式下显示

java - Android DialogPreference 宽度

java - ConfigChanges 期间 ActionBar 的导航模式变化