0

I'm currently developing a MAUI app, and I use the <Border /> a lot, but when tried to use it inside a Grid that's 335 units of width it gets cut, here's my code:

<ScrollView x:Name="InputScroll">
  <Grid
       HorizontalOptions="Center"
       Margin="0,25,0,25"
       VerticalOptions="Start"
       WidthRequest="335">
        <Grid.RowDefinitions>
           <RowDefinition Height="25" />
           <RowDefinition Height="*" />
           <RowDefinition Height="37" />
        </Grid.RowDefinitions>

        <Border
          Background="White"
          StrokeThickness="0"
          Grid.Row="0"
          Grid.RowSpan="3">
            <Border.StrokeShape>
              <RoundRectangle CornerRadius="20" />
            </Border.StrokeShape>
        </Border>
  </Grid>
</ScrollView>

All of this inside a ContentPage

On iOS it works perfectly as shown in the image.

enter image description here

But on Android shows like this

enter image description here

If I go below 300 units it works perfectly, but I get a huge space on the right side.

I'm not sure if I'm missing something that's really obvious or it's just broken there but any help or clue on how to handle/fix this would be much appreciated.

Thanks in advance

Asfiroth
  • 62
  • 1
  • 1
  • 6

1 Answers1

0

I trid the code you provided and I found that the code HorizontalOptions="Center" made this error on Android platform. I removed HorizontalOptions="Center" then tested on Android and Windows platform, it worked well.

   <ScrollView x:Name="InputScroll">
        <Grid
       Margin="0,25,0,25"
       VerticalOptions="Start"
       WidthRequest="335"
            Background="black">
            <Grid.RowDefinitions>
                <RowDefinition Height="25" />
                <RowDefinition Height="*" />
                <RowDefinition Height="37" />
            </Grid.RowDefinitions>

            <Border
          Background="red"
          StrokeThickness="0"
          Grid.Row="0"
          Grid.RowSpan="3">
                <Border.StrokeShape>
                    <RoundRectangle CornerRadius="20" />
                </Border.StrokeShape>
            </Border>
        </Grid>
    </ScrollView>
Guangyu Bai - MSFT
  • 2,555
  • 1
  • 2
  • 8
  • It worked, thanks, but it's a strange behavior when using the `HorizontalOptions="Center"` attribute though. Thanks. – Asfiroth Feb 13 '23 at 15:44