回答
我做这在我的汉堡包的倍率为UIElement CreateRootElement()
我的数据库设置后/迁移完成。
if(Template10.Utils.DeviceUtils.Current().IsPhone()){
var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
if(statusBar != null)
{
if(Application.Current.RequestedTheme == ApplicationTheme.Light)
//background && foreground or combination, and dependent on color choices
statusBar.ForegroundColor = Windows.UI.Colors.Black;
else if(Application.Current.RequestedTheme == ApplicationTheme.Dark
statusBar.ForegroundColor = Windows.UI.Colors.White;
}
}
Template10已经有很多内置的逻辑只需要知道它在哪里。正如@Jay佐说你要还包括移动的基准以及..
非常感谢!这解决了这个问题。 我只有一个问题,例如:如果应用程序的主题是黑暗的,我改变光的主题,它只有当我关闭和打开应用程序更新状态栏。当我更改应用程序主题时,有什么方法可以更新状态栏吗? –
存在一些代码异味片段,但它需要稍微改变基本的T10代码以促进这种改变。不幸的是,当前的GitHub存储库现在还没有形成,因为该库目前正在通过代码重构进行分支和尝试更改。 – mvermef
谢谢!另一个问题,这是可能的吗?当主题较亮时: 'statusBar.BackgroundColor = Colors.Black; statusBar.ForegroundColor = Colors.White;' –
正如@mvermef说,要解决这个问题,我们可以设置根据应用程序的主题在状态栏中使用的颜色。我们可以通过使用Application.RequestedTheme属性来获取应用程序的主题,并通过使用StatusBar类中的属性来设置状态栏的颜色。举个简单的例子:
public MainPage()
{
InitializeComponent();
NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
var statusBar = StatusBar.GetForCurrentView();
if (statusBar != null)
{
if (Application.Current.RequestedTheme == ApplicationTheme.Light)
{
statusBar.ForegroundColor = Windows.UI.Colors.Black;
}
else if (Application.Current.RequestedTheme == ApplicationTheme.Dark)
{
statusBar.ForegroundColor = Windows.UI.Colors.White;
}
}
}
}
请注意使用StatusBar
类,我们需要参考的Windows Mobile扩展了UWP项目。
拟定了以下Template10 ... – mvermef
我把我的代码文件中:App.xaml.cs在公共覆盖异步任务OnStartAsync(StartKind startKind, IActivatedEventArgs args)。在你的例子中你在MainPage中有这个代码。有区别吗? –
@FernandoSousa我把它放在MainPage中。在'OnStartAsync'中使用它也应该有效。 –
- 1. 通知不会出现
- 2. 通知不会出现在Android TV上
- 3. StatusIcon不会出现在通知区域
- 4. 未知栏不断出现
- 5. 设置Rails闪光通知在星期几出现
- 6. 从AsynTask更新通知栏会导致通知栏崩溃
- 7. Bootstrap模式不会出现在流星
- 8. 停止Android通知栏出现在触摸事件
- 9. Xcode 6键盘光标不会出现在模拟器中
- 10. 在状态栏(Android)中实现交互式通知
- 11. 通知权限被拒绝(桌面推送通知)。通知弹出窗口不会出现在Chrome中
- 12. 通知栏在asynctask
- 13. 解析推送通知不会出现在Android上的通知托盘上
- 14. 栏按钮不会出现在PageViewController中
- 15. 边栏不会出现在引导
- 16. 通知模型/模式
- 17. Rails:我如何显示闪光灯[:通知]模式
- 18. respond_with&闪光通知
- 19. 在睡眠模式下,应用程序不会通知本地通知
- 20. Javascript通知栏 - 每天只出现一次?
- 21. Firebase通知不会出现在我的设备上
- 22. iphone - 推送通知即使在禁用后也会出现
- 23. 今天扩展不会出现在通知中心
- 24. iPad中的推送通知不会出现在设置
- 25. android通知不会出现在它的时间
- 26. 通知不会出现在应用程序
- 27. iOS 10通知不会出现在锁定屏幕上
- 28. 通知栏
- 29. 推送通知不出现
- 30. Android通知重新出现
正确的,因为你没有发送的状态栏的背景颜色。它不是自动处理的。该框架没有考虑到这一点,不认为它会永远。留给开发者,因为它可能是一个对比色或相近色调的默认 – mvermef