Working with images Xamarin.Forms

I tried to follow the "Working with images (Local Image)" guide on Xamarin.com, it works great on iOS and WP, but not on Android.

The image is set as AndroidResource and placed in Resources/Drawable, but when I try to do:

        Image login_img = new Image {

            WidthRequest = 32,
            HeightRequest = 32,
            Source = "login_user.png",

        };

No image is displayed on Android... Someone suggested that I use EmbeddedResource, this works, but is VERY slow when scrolling images in a list view or navigating to a page using lots of EmbeddedResources.

Any suggestions on how to fix Local Image?

Answers

  • DanielLDanielL PLInsider ✭✭✭✭

    You could try FFImageLoading (https://github.com/molinch/FFImageLoading/) CachedImage which is API compatible Image replacement with caching capabilities (and a lot more). It should make your lists faster as it reuses the same bitmap multiple times. Image creates multiple bitmaps even the source is the same.

Sign In or Register to comment.