Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Same xaml with different results on various Android devices

$
0
0

Hello,
I am coding a layout for WP, Android and iOS. I am using grids with heights and widths to adapt to the size of the screen. It all looks fine in iOS and WP, but in Android things look misplaced, with different behavior in different phones. This is exactly the same code. It is just grids inside grids. I thought it could be because of the labels or something, but i repeated this page removing all the labels - only showing the upper image and lines - and it still looked strange.
All the separators should be 0.5 (constant), the rest is based on 1* 2* etc.
The behavior even changes in the same phone, from time to time!

Phone A (Xperia E3)

Phone A again

Phone B (Moto E) notice the lack of separator in the end

Phone C (Wiko Iggy) notice the separator with different height

All pages in this app render with these issues on Android. Only on Android.
I also coded very similar layouts using stacklayouts and relativelayouts, doing my own calculations instead of using rows and widths (i get screen size at runtime and do my own calculations). My hint is that this might be a bug concerning grid rows and probably remaining space not being managed by xamarin.forms.

All my pages are based on code like this:
I tried both relative heights and Autos.

<ScrollView
      Grid.Row="1">
      <Grid
        HorizontalOptions="FillAndExpand"
        BackgroundColor="Gray"
        RowSpacing="0">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="2*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="2*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="2*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="2*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
          <RowDefinition Height="0.5"/>
          <RowDefinition Height="3*"/>
        </Grid.RowDefinitions>
        <Image
          Grid.Row="0"
          HorizontalOptions="FillAndExpand"
          Source="{extensions:ImageResource CTT.XForms.Images.photo_info.jpg}"/>
        <Grid
          Grid.Row="2"
          BackgroundColor="White"
          RowSpacing="0">
          <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="1*"/>
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="7*"/>
          </Grid.ColumnDefinitions>
          <Label
            Style="{StaticResource FormLabelStyle}"
            Grid.Row="1"
            Grid.Column="1"
            Text="CTT"/>
          <Label
            VerticalOptions="Center"
            Grid.Row="1"
            Grid.Column="2"
            TextColor="Gray"
            Text="for Android, V1.3.5"
            HorizontalOptions="Start"/>
        </Grid>

Thanks ;)


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>