Stacklayout not fill whole screen

271 Views Asked by At

There is a little dark space on the screen. I dont want these dark space here. How can i delete or make bigger my stacklayout ?

My xaml :

 <StackLayout  VerticalOptions="FillAndExpand" HorizontalOptions="Center" Padding="0" >...  </StackLayout>

enter image description here

This is my HomePage's xaml file :

https://www.paste.tc/homepagexaml

2

There are 2 best solutions below

0
Mert Altiparmak On BEST ANSWER

Solution: I changed Targeted Api version a lower one. I think my screen resolution was too high and that lower api version does not support that huge resolution. And i saw that blank spot on phone screen. enter image description here

7
Jessie Zhang -MSFT On

You can try to set the value of property HorizontalOptions of StackLayout to FillAndExpand,just as follows:

 <StackLayout  VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Padding="0" BackgroundColor="Yellow"> 

    <Button  Text="test"  HeightRequest="80"  />

</StackLayout>

Of course, you can also use Grid to achieve this. You can set the special height for the control you need, and set the height of other RowDefinition to *, it will occupy the other space of the screen.

You can refer to the following code:

   <Grid  BackgroundColor="Yellow">
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <BoxView Color="Green" />

    </Grid>