如何使状态栏在.NET MAUI Visual Studios 2022中完全透明
因此,我能够发现您可以使用名称的代码使Android上的状态栏完全透明:
var s = SystemUiFlags.LayoutFullscreen | SystemUiFlags.LayoutStable;
FindViewById(Android.Resource.Id.Content).SystemUiVisibility = (StatusBarVisibility)s;
Window.SetStatusBarColor(Android.Graphics.Color.Transparent);
WindowInsetsControllerCompat windowInsetsController = new WindowInsetsControllerCompat(Window, Window.DecorView);
windowInsetsController.AppearanceLightStatusBars = true;
由于此代码被弃用,我如何实现最高状态栏完全透明的相同效果,就像与背景颜色相匹配的当时屏幕上有什么图片或颜色。我在vs 2022中使用.Net Maui。
So I was able to find that you can use depricated code to make the status bar on Android fully transparent:
var s = SystemUiFlags.LayoutFullscreen | SystemUiFlags.LayoutStable;
FindViewById(Android.Resource.Id.Content).SystemUiVisibility = (StatusBarVisibility)s;
Window.SetStatusBarColor(Android.Graphics.Color.Transparent);
WindowInsetsControllerCompat windowInsetsController = new WindowInsetsControllerCompat(Window, Window.DecorView);
windowInsetsController.AppearanceLightStatusBars = true;
Since this code is deprecated, how do I achieve the same effect of the top status bar being fully transparent, as matching the background color of whatever picture or color is on the screen at the time. I am using .NET MAUI in VS 2022.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该在页面上的代码:
mainActivity.cs中的代码
Code that should be on the page:
Code in MainActivity.cs