开发者

Get Locked Orientation

Is there a method to detect 开发者_JAVA百科if the Auto-Rotation Lock of the device is on or off? My app needs to access that method to lock the orientation during runtime.


Add this in your Manifest file in your activity for the fixed orientation you want for your Activity

android:screenOrientation="portrait"

like

<activity android:name=".Settings" android:label="@string/app_name" android:screenOrientation="portrait">

or in java code you can use

setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 


In iPhone there is a method

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return YES;
}

To unlock orientation. if u want to make it lock then change its value (YES to NO) where u want to lock orientation

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜