导航栏剪切的模态中的全宽图像

问题描述

我正在尝试在模态内创建全角图像,但是该图像在某些iOS设备上位于导航栏的后面。

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MyApp.ModalWithFullWidthImage" 
             NavigationPage.HasNavigationBar="True">
    <ContentPage.Content>
        <StackLayout Grid.Column="0" Grid.Row="0" >
            <Image Source="fullWithImage" Aspect="AspectFill" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

enter image description here

问题出在iPhone 11上:导航栏遮挡了图像的顶部。图像看起来好像在导航栏的后面。在iPhone 8上,图像很好。

我需要图像保持其外观,但要在宽度上保持一致。高度可以可变,并且可以在较小的设备上断开。

我希望找到一个仅使用Xaml的解决方案。我已经看到了在后面的代码中调整图像的解决方案,但是我必须相信有一个更简单的解决方案或解决方法

解决方法

尝试将HorizontalOptionsVerticalOptionsFillAndExpand添加:

<StackLayout>
    <!-- Place new controls here -->
    <Image Source="Images" Aspect="AspectFill" HorizontalOptions="FillAndExpand"
   VerticalOptions="FillAndExpand"/>
</StackLayout>

引用:Image with AspectFillxamarin-forms-image-fill-width-with-proper-aspect

,

您是否尝试过在ContentPage上使用homehttps://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/ios/page-safe-area-layout

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...