0

I try to create an application sample with Xamarin using XAML et Visual Studio. For exemple, the following code is InitPage.xaml.

<RelativeLayout>
    <Image Source="baseandroid.png" 
           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,Property=Width}"
           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,Property=Height}"/>
    <Grid RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,Property=Width}"
          RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,Property=Height}">

        <Label FontSize="14" Text="test" TextColor="White" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"

/>

baseandroid.png can be found in Android > Ressources > Drawable

But i can't display image enter image description here

piks
  • 1
  • Possible duplicate of [Xamarin Forms image not showing-Android](https://stackoverflow.com/questions/37426950/xamarin-forms-image-not-showing-android) – Intsab Haider Oct 17 '18 at 12:42

1 Answers1

1

In your xaml code, you are setting the Image within the RelativeLayout outside the ContentPage.Content tag. You must place it inside the ConetntPage.Content.

hashimks
  • 1,205
  • 2
  • 11
  • 29