0

I have a strange issue in Android with Xamarin.Forms. I currently developing an application in macOs platform with Visual Studio for Mac.

I did my first test with IOS simulator to test if display was the same from the previewer, and that the case.

So to be sure, I tried in an Android simulator, but was not the case.

I will show you the part of the UI that have an issue & the related code.

The previewer show that :

enter image description here

Android display this :

enter image description here

This is the code :

<Grid BackgroundColor="#fff" >
        <Grid.RowDefinitions>
            <RowDefinition Height="6*" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Image Grid.Row="0" Grid.Column="0" x:Name="HomePicture" Aspect="Fill" Source="https://s-media-cache-ak0.pinimg.com/originals/83/be/d9/83bed977a3c806ffce7fda49e1bf0573.jpg" />
        <StackLayout Grid.Row="1" Grid.Column="0" Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="0.4*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*" />
                    <ColumnDefinition Width="7*" />
                    <ColumnDefinition Width="1*" />
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="1" TextColor="Black" x:Name="PicaplantTitleLbl" FontSize="20" Font="Bold" XAlign="Center">
                </Label>
                <Label Grid.Row="1" Grid.Column="1" TextColor="Gray" x:Name="PicaplantSpeechLbl" FontSize="12" XAlign="Center">
                </Label>
            </Grid>
        </StackLayout>
        <Button x:Name="PicaplantStartBtn" Clicked="OnStartButtonClicked" TextColor="White" BackgroundColor="Green" Grid.Row="2" Grid.Column="0" BorderRadius="0" FontSize="30" />
    </Grid>
OrcusZ
  • 3,555
  • 2
  • 31
  • 48
  • Try to use more space for your stacklayout in the RowDefinition (instead of 6*, 3*, 1*, try something like 7*,4*,1* or wathever can suits you). You depend also on the configuration of the phone (maybe the fonts configuration on your phone is "large" instead of "normal") – hugo Aug 05 '17 at 12:28
  • I will try some configuration to see if one resolves the problem. About the font, can I "overwrite" the phone configuration if I set a fontSize ? – OrcusZ Aug 05 '17 at 13:43
  • 1
    In Xamarin.Android, you can specify font size with dp (Density-independent Pixels) or sp (Scale-independent Pixels) --> explained here (https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp-on-android). With forms, I don't know (but I think this is possible) – hugo Aug 05 '17 at 15:47

0 Answers0