[iOS][Android]: How to hide the status bar with platform UNO?

Deadly 提交于 2021-01-29 21:15:19

问题


How would I hide the status bar on top of the screen in iOS (and Android).

Believe, Xamarin.Forms has a way to do that. But how would I do that with Platform UNO?

Thanks in advance

Dierk


回答1:


Uno Platform supports the UWP StatusBar API on Android and iOS, you can hide and show the status bar in the following manner:

        private void HideStatusBar()
        {
            var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();

            Windows.UI.Xaml.Window.Current.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                async () => await statusBar.HideAsync()
            );
        }

        private void ShowStatusBar()
        {
            var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();

            Windows.UI.Xaml.Window.Current.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                async () => await statusBar.ShowAsync()
            );
        }


来源:https://stackoverflow.com/questions/64440117/iosandroid-how-to-hide-the-status-bar-with-platform-uno

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!