Prevent Orientation change in Xamarin Android Appl

2020-08-09 06:25发布

Is it possible to prevent the orientation of an Android application from changing ? I have an application that previews the phone camera and I would like the orientation not to change.

I have tried adding this to the manifest but it did not make a difference

<application android:label="TextureViewCameraStream" android:hardwareAccelerated="true">
    </application>
    <activity
       android:screenOrientation="portrait"
       android:configChanges="orientation|keyboardHidden">
    </activity>

I am using Xamarin for Android and C#

Thank you

1条回答
forever°为你锁心
2楼-- · 2020-08-09 06:42

Set it in the Activity flag like this:

[Activity (Label = "YourActivityname", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)] 
查看更多
登录 后发表回答