Open kxgonzalez opened 6 years ago
Hi @kxgonzalez , were you able to fix this?
Hi @kxgonzalez
Try to use LockOrientation
method, for example:
CrossDeviceOrientation.Current.LockOrientation(DeviceOrientations.Landscape);
@wcoder - DeviceOrientations.Landscape
keeps device window on horizontal left orientation only, but I want app to rotate horizontally to left as well as right. Is it possible with this plugin?
Currently, there is no such functionality.
But you can setup platform manifests "supported device orientation" https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/device-orientation?tabs=vswin for allow only landscape orientation
Yes, but that would set it on a complete application, right? I want to set only horizontal orientation on a specific screen.
I'm in the same situation. I have a multipurpose app; one mode has views designed to be vertical. I have no problem with this. The other mode is designed to be horizontal, so I want to be able to rotate it landscape and landscape inverted. I tried with some logic but it fires after the rotation and animation happens.
Currently, this plugin supported lock of device orientation only for one direction.
This situation (more than one direction) will good enhancement for next version of the plugin.
I can propose the workaround for yours:
Manual override these methods on each platform:
MainActivity.cs
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) {}
AppDelegate.cs
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow){}
In these methods, you can lock the device orientation for the required page.
Nice, thank you!
Hi, I want to prevent the app to be rotated to portrait mode in certain scenarios, but I need it available so I can't disable it completely. I know we have the OrientationChanged event but it fires after the orientation changes.
In other words; I want the app to be available in landscape and landscape flipped mode. How can I achieve this?
I'm currently using Xamarin.Forms with PCL.