Absolute Layout, image at full screen height and center screen width for image?

RussellFustinoRussellFustino USUniversity ✭✭
edited February 2017 in Xamarin.Forms

I am fairly new to the Absolute layout constraints, and the XAML below provides an image of the full height of the screen in UWP (image height/width=639/930), but only about ¾ height available in Android (image height/width= 502/730) . Any idea why the Android version is not full height as well? iOS is similar to Android. Any tips to look at here would be appreciated, it’s got me stumped at the moment. Thanks! UWP is in back, Android in front in this snapshot. I am also looking to center the absolute image in the layout? I am using the Mr. Gestures plug-in, but I get the same results without it.

<?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="Crosswalk.Views.PathwayDetailPage"
             xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures"
             xmlns:local="clr-namespace:Crosswalk;assembly=Crosswalk"
             Title="{Binding PathwaySchema.name}"
             >
  <ContentPage.Resources>
    <ResourceDictionary>
      <local:ImageConverter x:Key="ImageConverter" />

    </ResourceDictionary>
  </ContentPage.Resources>

  <RelativeLayout>
    <mr:AbsoluteLayout
                    RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                    RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                    RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}"
                    RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.90}"

                    BackgroundColor="#808080"
                    >

   <mr:Image x:Name="myImage"
      Source="{Binding PathwaySchema.app_file_image_name} Converter={StaticResource ImageConverter}"  Aspect="AspectFill"
      RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=100}"
                    RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.90}"
                    RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}"
                    RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.10}"

>           
          </mr:Image>


    </mr:AbsoluteLayout>


  </RelativeLayout>
</ContentPage>
Sign In or Register to comment.