デバイスを回転させたときに、デバイスが向きを変えるのにかかるおおよその時間を知りたいと思っています。私のアプリでは、電話デバイスを回転させると、画面が回転するのに約 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>