2
I need to use it on a screen Grid
(to organize the Entry and Buttons) and AbsoluteLayout
(to have the waiting ball (or Loading) in the middle of the screen). If this is done the screen layout is deformed (image below). If I take the AbsoluteLayout
the screen is organized as it should.
My need is to utilize the Grid
and the AbsoluteLayout
without having the deformations.
Follows the XAML code:
<?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="FoodSuppy.Login"
Title="FoodSuppy">
<AbsoluteLayout>
<Grid>
<Grid.RowDefinitions>
<!-- Define as linhas -->
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<BoxView Grid.Row="0"
BackgroundColor="Bisque"/>
<BoxView Grid.Row="1"
BackgroundColor="Accent"/>
<BoxView Grid.Row="2"
BackgroundColor="Aqua"/>
<BoxView Grid.Row="3"
BackgroundColor="Beige"/>
<BoxView Grid.Row="4"
BackgroundColor="Blue"/>
<!-- Entry's -->
<Entry Grid.Row="2"
x:Name="entryEmail"
Text="[email protected]"
FontSize="Small"
VerticalOptions="StartAndExpand"/>
<Entry Grid.Row="2"
x:Name="entrySenha"
IsPassword="True"
Text="123456"
FontSize="Small"
VerticalOptions="CenterAndExpand"/>
<!-- Botões -->
<Button Grid.Row="3"
Text="Cadastro"
Clicked="btnCadastrarUserAsync"
TextColor="White"
HorizontalOptions="Start"
VerticalOptions="StartAndExpand"
FontSize="Small"
BackgroundColor="DodgerBlue"
Margin="0"/>
<Button Grid.Row="3"
x:Name="btnAcessar"
Clicked="btnAcessar_Clicked"
HorizontalOptions="Center"
VerticalOptions="StartAndExpand"
Text="Acessar"
TextColor="White"
FontSize="Small"
BackgroundColor="DodgerBlue"
Margin="0"/>
<Button Grid.Row="3"
Text="Sair"
Clicked="Sair_Clicked"
HorizontalOptions="End"
VerticalOptions="StartAndExpand"
TextColor="White"
FontSize="Small"
BackgroundColor="DodgerBlue"
Margin="0"/>
</Grid>
<!-- Loading -->
<StackLayout IsVisible="{Binding IsLoading}"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="DodgerBlue"
Opacity="0.5">
<!-- Loading -->
<ActivityIndicator x:Name="actInd"
IsRunning="{Binding IsLoading}"
IsVisible="{Binding IsLoading}"
Color="DarkBlue"
HeightRequest="60"
WidthRequest="60"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand">
</ActivityIndicator>
</StackLayout>
</AbsoluteLayout>
</ContentPage>
Simply incredible, it worked perfectly and I learned one more.
– Deivid Souza