Giter VIP home page Giter VIP logo

Comments (8)

rakeshostwal avatar rakeshostwal commented on May 25, 2024

Hi @kxgonzalez , were you able to fix this?

from xamarin.plugin.deviceorientation.

wcoder avatar wcoder commented on May 25, 2024

Hi @kxgonzalez

Try to use LockOrientation method, for example:

CrossDeviceOrientation.Current.LockOrientation(DeviceOrientations.Landscape);

from xamarin.plugin.deviceorientation.

rakeshostwal avatar rakeshostwal commented on May 25, 2024

@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?

from xamarin.plugin.deviceorientation.

wcoder avatar wcoder commented on May 25, 2024

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

from xamarin.plugin.deviceorientation.

rakeshostwal avatar rakeshostwal commented on May 25, 2024

Yes, but that would set it on a complete application, right? I want to set only horizontal orientation on a specific screen.

from xamarin.plugin.deviceorientation.

kxgonzalez avatar kxgonzalez commented on May 25, 2024

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.

from xamarin.plugin.deviceorientation.

wcoder avatar wcoder commented on May 25, 2024

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:

Android

MainActivity.cs

public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) {}

iOS

AppDelegate.cs

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow){}

In these methods, you can lock the device orientation for the required page.

from xamarin.plugin.deviceorientation.

kxgonzalez avatar kxgonzalez commented on May 25, 2024

Nice, thank you!

from xamarin.plugin.deviceorientation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.