uwp 沉浸式状态栏

//隐藏状态栏
if
(ApiInformation.IsTypePresent(typeof(StatusBar).ToString())) { StatusBar statusBar = StatusBar.GetForCurrentView(); await statusBar.HideAsync(); }

 

    using namespace Windows::UI;
    using namespace Windows::Foundation::Metadata;
    using namespace  Windows::UI::ViewManagement;
    
   //透明度0-1之间,0为全透明,1为不透明  
     //全透明时候可能 前景色与默认色一致导致 信号等信息显示不出来,可改不透明或者改前景色
     //全屏模式下 与底色做透明运算。。可类似沉浸式状态栏
//判断当前环境是否支持ViewManagement.StatusBar
    if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
    {
        //设置全屏模式 
        var applicationView =ApplicationView.GetForCurrentView();
        applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
var statusBar
= ViewManagement.StatusBar.GetForCurrentView(); statusBar.BackgroundColor =Colors.Red; //背景色 statusbar.BackgroundOpacity = 0; statusbar.ForegroundColor = Colors.Blue; //信号 时间等绘制颜色 //statusbar.ProgressIndicator.Text = "test"; //显示提示字和 。。。 //statusbar.ProgressIndicator.ShowAsync(); }

参考:

1.https://blogs.msdn.microsoft.com/gianlucb/2015/10/08/uwp-windows-10-app-titlebar-and-status-bar-customization/

2.https://blogs.msdn.microsoft.com/amar/2014/05/11/status-bar-in-windows-phone-8-1/

3.https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.statusbar.aspx

posted @ 2016-09-02 20:21  frendguo  阅读(591)  评论(0编辑  收藏  举报