开发者

Orientation Change Default Time Delay...?

I am wondering to kno开发者_开发百科w that what time a device approximately takes to change the orientation, when we rotate it. In my app when i rotate my phone device, it approximately takes 1 to 2 sec's to rotate the screen. Now my question is, Is it a normal span or it's a delayed span. So that i can work on it accordingly.

Thanks in advance.


From a little code research, it looks like it takes at least 200ms before rotating the view. This delay is to make sure the change in device orientation is intentional.

Code snippet from WindowOrientationListener.java for reference:

// 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;


add android:configChanges="orientation|screenSize" inside the Manifest file. For example

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜