HorizontalStackLayout doesn´t work with images in MAUI on iOS

194 views Asked by At

I have a page with a simple grid of 2 rows and 1 column, inside the grid I have an HorizontalStackLayout with 2 images (dotnet_bot). The problem is that on iOS devices the images are not visible but on Android devices they are (see images attached). I also tried with not using the HorizontalStackLayout and instead set the parent grid with 2 columns, but the result is almost the same. I test it with phisical devices (Huawei, Samsung on Android and iPhone 8) and simulated (iPhone 13,14) and there is not differences. Here is my code:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="Testapp2.MainPage">

<Grid RowDefinitions="25*,75*" ColumnDefinitions="100*">

    <HorizontalStackLayout HorizontalOptions="CenterAndExpand">
        <Image Source="dotnet_bot.png" Scale="1" Aspect="AspectFit"/>
        <Image Source="dotnet_bot.png" Scale="1" Aspect="AspectFit"/>
</Grid>
</ContentPage>

The other approach without HorizontalStackLayout

<Grid RowDefinitions="25*,75*" ColumnDefinitions="50*,50*">
        <Image Grid.Column="0" Source="dotnet_bot.png" Scale="1" Aspect="AspectFit"/>
        <Image Grid.Column="1" Source="dotnet_bot.png" Scale="1" Aspect="AspectFit"/>
</Grid>

Android iPhone

1

There are 1 answers

1
Luis Guzman On

I solved the problem by starting a new project, but only with the robot image provided by MAUI. I noticed that images on iOS do have issues with resizing and fitting correctly. There is an open issue on github about this. Link