如何在 Xamarin.Forms 中允许 iOS 状态栏和 iPhone X 缺口 [英] How to allow for iOS status bar and iPhone X notch in Xamarin.Forms
本文介绍了如何在 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?
谢谢!
推荐答案
use 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屋!
查看全文