【发布时间】:2020-09-19 22:00:36
【问题描述】:
只有当我将方向设置为 ScreenOrientation.FullSensor 时,应用程序才会自动倒置(反向纵向)。
但是,它也有我不想要的风景。
我尝试在方向更改时覆盖方向,但该回调不会覆盖参数,它会继续执行方向更改而不返回。
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
{
if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape)
{
newConfig.Orientation = Android.Content.Res.Orientation.Portrait;
}
base.OnConfigurationChanged(newConfig);
}
如何在纵向和反向纵向之间自动定位我的 xamarin 应用程序?
【问题讨论】:
-
声明活动方向“sensorPortrait”。请参阅developer.android.com/guide/topics/manifest/… 的文档
标签: c# android xamarin android-sensors android-orientation