当我尝试这样做的时候:
https://docs.microsoft.com/en-us/xamarin/essentials/app-theme?tabs=ios
无论我的模拟器或设备的“暗”设置如何,appTheme总是亮的。
我还尝试了这个:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/theming/system-theme-changes
但是我找不到获取设置主题的代码。
感谢您的帮助!
谢谢!拉里
发布于 2020-12-18 04:20:12
UIKit.TraitCollection.UserInterfaceStyle包含当前应用|查看暗/亮设置
if (this.TraitCollection.UserInterfaceStyle == UIUserInterfaceStyle.Dark)
{
// dark
}
else
{
// light
}回复:https://docs.microsoft.com/en-us/dotnet/api/uikit.uiuserinterfacestyle?view=xamarin-ios-sdk-12
更新:
“仍然总是返回光亮。”
如果您的info.plist包含设置为Light的UIUserInterfaceStyle条目,它将覆盖操作系统设置。删除此项或将其设置为Automatic。
https://stackoverflow.com/questions/65346437
复制相似问题