【发布时间】:2020-06-17 20:05:04
【问题描述】:
我已尝试在 MainActivity.cs 上设置此代码
[Activity(Label = "PG_ELearning.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
但是这个锁定的屏幕旋转适用于所有屏幕。我想要一些屏幕(我正在播放视频)应该有横向模式。所有屏幕都在 Xamarin PCL 共享代码中。 我确实访问了这些链接:
http://www.appliedcodelog.com/2017/05/force-landscape-or-portrait-for-single.html
How to detect screen orientation of the device in Xamarin.Forms?
但我找不到正确的方法。
【问题讨论】:
-
可以吗?
-
抱歉@LeoZhu-MSFT 优先级已更改。我会在 2-3 天内给你反馈
-
好的,祝你好运!
标签: android xamarin.forms screen-orientation