0
I have a problem a little unusual and I did not find references in the searches I performed.
I have a Xamarin Forms application and on the login screen the Grid does not fit the layout getting compressed and showing no control on the screen.
To make it easier to understand, I left the screen as simple as possible by changing the background image for a solid color.
I have changed the login screen several times, but without success. I’ve tried it with Grid, without Grid, Grid with lines, Grid without lines, Stacklayout for each Grid row, Stacklayout unique, with Frame, without Frame, but nothing solves.
And to make matters worse, in the tests done by the robot at firebase, they found no errors.
This only happens in some Xiaomi (in other devices, even Xiaomi, it does not occur).
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:MySample.Controls"
BackgroundImage="solid.png"
x:Class="MySample.Views.LoginView">
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS" Value="0,20,0,0" />
</OnPlatform>
</ContentPage.Padding>
<ContentPage.Content>
<Grid x:Name="gridExterno"
RowSpacing="0"
ColumnSpacing="0"
Padding="30,20,30,5"
BackgroundColor="White"
Margin="30,5"
VerticalOptions="CenterAndExpand" HorizontalOptions="Center">
<Grid.MinimumHeightRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="600" Phone="300" Desktop="300"/>
</Grid.MinimumHeightRequest>
<Grid.MinimumWidthRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="800" Phone="600" Desktop="600"/>
</Grid.MinimumWidthRequest>
<Grid.WidthRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="800" Phone="600" Desktop="600"/>
</Grid.WidthRequest>
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Grid.Row="0" Source="logo.png" VerticalOptions="Center" HorizontalOptions="Center" Margin="0,10,0,10">
<Image.WidthRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="350" Phone="300" Desktop="300"/>
</Image.WidthRequest>
</Image>
<StackLayout
Orientation="Vertical"
Grid.Row="1"
VerticalOptions="Center"
HorizontalOptions="Center"
Spacing="15"
Margin="10">
<Entry x:Name="EntryLogin"
TextChanged="OnEntryLoginTextChanged"
MaxLength="20"
Text=""
Keyboard="Numeric"
HorizontalOptions="FillAndExpand">
<Entry.WidthRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="400" Phone="300" Desktop="300"/>
</Entry.WidthRequest>
<Entry.HeightRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="75" Phone="50" Desktop="50"/>
</Entry.HeightRequest>
<Entry.Margin>
<OnIdiom x:TypeArguments="Thickness" Tablet="0,0,0,20" Phone="0" Desktop="0"/>
</Entry.Margin>
<Entry.FontSize>
<OnIdiom x:TypeArguments="x:Double" Tablet="30" Phone="20" Desktop="20" />
</Entry.FontSize>
</Entry>
<Entry x:Name="EntryPassword"
Text=""
MaxLength="20"
IsPassword="True"
HorizontalOptions="FillAndExpand">
<Entry.Margin>
<OnIdiom x:TypeArguments="Thickness" Tablet="0,0,0,20" Phone="0" Desktop="0"/>
</Entry.Margin>
<Entry.WidthRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="400" Phone="300" Desktop="300"/>
</Entry.WidthRequest>
<Entry.HeightRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="75" Phone="50" Desktop="50"/>
</Entry.HeightRequest>
<Entry.FontSize>
<OnIdiom x:TypeArguments="x:Double" Tablet="28" Phone="20" Desktop="20"/>
</Entry.FontSize>
</Entry>
<StackLayout Orientation="Horizontal" Spacing="16" HorizontalOptions="FillAndExpand">
<StackLayout.Margin>
<OnIdiom x:TypeArguments="Thickness" Tablet="2,0" Phone="0" Desktop="0"/>
</StackLayout.Margin>
<CheckBox x:Name="ckRemember"/>
<Label Text="Remember Me" VerticalOptions="Center">
<Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" Tablet="26" Phone="18" Desktop="18"/>
</Label.FontSize>
</Label>
</StackLayout>
<Button x:Name="btnEntrar1"
Text="Enter"
BackgroundColor="{StaticResource ButtonPrimary}"
Clicked="OnLoginAsync"
TextColor="White"
HorizontalOptions="FillAndExpand">
<Button.WidthRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="400" Phone="300" Desktop="300"/>
</Button.WidthRequest>
<Button.HeightRequest>
<OnIdiom x:TypeArguments="x:Double" Tablet="75" Phone="50" Desktop="50"/>
</Button.HeightRequest>
<Button.FontSize>
<OnIdiom x:TypeArguments="x:Double" Tablet="18" />
</Button.FontSize>
<Button.Margin>
<OnIdiom x:TypeArguments="Thickness" Tablet="0,15,0,0" Phone="0" Desktop="0"/>
</Button.Margin>
</Button>
<Label x:Name="lblVersion"
VerticalOptions="End"
HorizontalTextAlignment="Center"
HorizontalOptions="Center">
<Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" Tablet="20" Phone="16" Desktop="16"/>
</Label.FontSize>
<Label.Margin>
<OnIdiom x:TypeArguments="Thickness" Tablet="0,0,0,10" Phone="0,3,0,5" Desktop="0,3,0,5"/>
</Label.Margin>
</Label>
</StackLayout>
</Grid>
</ContentPage.Content>
</ContentPage>