防止 Xamarin Android 应用程序中的方向更改 [英] Prevent Orientation change in Xamarin Android Application

查看:17
本文介绍了防止 Xamarin Android 应用程序中的方向更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以防止 Android 应用程序的方向改变?我有一个可以预览手机摄像头的应用程序,但我希望方向不要改变.

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>

我使用 Xamarin for Android 和 C#

I am using Xamarin for Android and C#

谢谢

推荐答案

像这样在 Activity 标志中设置它:

Set it in the Activity flag like this:

[Activity (Label = "YourActivityname", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)] 

这篇关于防止 Xamarin Android 应用程序中的方向更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆