如何在Xamarin.Forms中允许iOS状态栏和iPhone X缺口 [英] How to allow for iOS status bar and iPhone X notch in Xamarin.Forms

查看:219
本文介绍了如何在Xamarin.Forms中允许iOS状态栏和iPhone X缺口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此还很陌生,如果这是一个愚蠢的问题,请对不起.如何在适当的状态栏或槽口下启动Xamarin.Forms应用程序?我试过使用NavigationPage,但随后它在屏幕顶部下方开始磨损.我还看到了其他一些解决方案,但无法使其正常工作. 有人可以帮忙吗?

I'm fairly new to this, so sorry if this is a dumb question. How do I get my Xamarin.Forms app to start below the status bar or the notch when applicable? I've tried using a NavigationPage, but then it started wear below the top of the screen. I've also seen a few other solutions, but I can't make it work. Can anyone help?

谢谢!

推荐答案

使用 UseSafeArea

using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
using Xamarin.Forms;

namespace iPhoneX 
{
    public partial class ItemsPage : ContentPage
    {
        public ItemsPage()
        {
            InitializeComponent();

            On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
        }
    }
}

这篇关于如何在Xamarin.Forms中允许iOS状态栏和iPhone X缺口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆