![](/img/trans.png)
[英]Reload XML Layout in Xamarin.Android on Orientation Change?
[英]Prevent Orientation change in Xamarin Android Application
是否可以防止 Android 應用程序的方向改變? 我有一個預覽手機攝像頭的應用程序,我希望方向不要改變。
我嘗試將其添加到清單中,但沒有任何區別
<application android:label="TextureViewCameraStream" android:hardwareAccelerated="true">
</application>
<activity
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden">
</activity>
我在 Android 和 C# 上使用 Xamarin
謝謝
像這樣在 Activity 標志中設置它:
[Activity (Label = "YourActivityname", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)]
如果您有一個 Activity,並且您希望它在打開時保持相同的方向,則使用此標簽:
[Activity(Label = "MyApp", ScreenOrientation = Android.Content.PM.ScreenOrientation.Locked)]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.