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.
Try writing this in
Menifest
file:For Xamarin change your code according to your need as: (ScreenOrientation.Portrait / ScreenOrientation.Landscape)