Search code examples
xamlxamarinxamarin.formsxamarin.android

I'm trying to implement a Xamarin local image on my App, but it's not working


I'm trying to add a local image in my Xamarin app, but it's not working. Do you know what I could've have missed?

I have added the XAML and c# code but that still does not work.

 XAML -  <Image x:Name="Background_Image" Source="backgroundimage.png"/>


C# - var image = new Image { Source = "backgroundimage.png" };

I have followed the proper practices to a tee from the Xamarin Images documentation, but it's still not working. Link to Xamarin Documentation on Images - (https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/images?tabs=vswin#Local_Images)

I have made sure the file name is

  • All in lowercase,
  • The build action is AndroidResource of the image
  • The image has been placed in the Resources/drawable folder.

Which are all the conventions you must follow, but it doesn't seem to work.

The image's file size is 1.28mb and resolution is 1920x1080 if that matters. I have tested with a much smaller 4KB image but does not work either. I am using the Xamarin Live Player to show the app, the phone uses API 19, Android 4.4

I apologise if this is a duplicate, but I have read many topics here but I have not been able to fix it.


Solution

  • It does seem to be a issue or limitation with Xamarin's own Live player. I have launched the App with the Android Emulator and the Image is displaying, I'll report it as a bug.