In my activity, I have the following code.
[Activity(Label = "SampleActivity", ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize | Android.Content.PM.ConfigChanges.KeyboardHidden)]
In OnCreate() ->
if (Build.VERSION.SdkInt >= Build.VERSION_CODES.Gingerbread) {
RequestedOrientation = ScreenOrientation.SensorLandscape;
}
else {
RequestedOrientation = ScreenOrientation.Landscape;
}
Still the screen flips in landscape mode itself if the Auto rotate is ON.Would like to know the reason why this happens?.Is there any option to avoid flipping?
Need help.Thanks in advance.
In order to lock your app in portrait mode, You have to add following line in your manifest file where you are defining your activity in the manifest file.
If you want to lock in landscape mode replace portrait with landscape.