防止Xamarin Android应用程序中的方向更改 [英] Prevent Orientation change in Xamarin Android Application
本文介绍了防止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用于Android和C#
I am using Xamarin for Android and C#
谢谢
推荐答案
在活动"标志中进行设置,如下所示:
Set it in the Activity flag like this:
[Activity (Label = "YourActivityname", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)]
这篇关于防止Xamarin Android应用程序中的方向更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文