In Xamarin.Android, to load an image using FFImageLoading, a ImageViewAsync must be used instead of a standard ImageView.
I couldn't find what I can use if I wanna load my image into an ImageButton. Didn't find an "ImageButtonAsync".
In Xamarin.Android, to load an image using FFImageLoading, a ImageViewAsync must be used instead of a standard ImageView.
I couldn't find what I can use if I wanna load my image into an ImageButton. Didn't find an "ImageButtonAsync".
Dont know if this is relevant or not. I gave my svg a tap gesture to get it working like a button.
first reference the FFImageLoading.Svg.Forms in your xaml
second add the svgImage with a tap gesture
You will call this in the constructor of your ViewModel to initialize the command
Create the properties that bind to the xaml file
The await ExecuteYourCommandAsync is a method that you create. and in there you will put your logic of what you actually want the tap gesture to do.
You can also pass through object with the command. let met know if this makes sense
AFAIK there is no particular
ImageButton
to use with FFImageLoading but you can use directly anImageViewAsync
set it asandroid:clickable="true"
and add the click event.And as stated here an
ImageButton
is just anImageView
that has a non-null background by default and also, ImageButton.onSetAlpha() method always returns false, scaleType is set to center and it's always inflated as focusable. So if you need that behaviour you can add it.Another way would be you to create your custom
ImageButton
that can handle FFImageLoading image loading. For that you can inherit fromImageViewAsync
and add the behaviours explained in the paragraph before. So that you can use the FFImageLoading API directly as this custom controls inheritsImageViewAsync
.Instead of that you can also add your custom loading logic as explained here inheriting from
ImageLoaderTask
and call it likeImageService.Instance.LoadImage(customImageTask)
Finally another way (but hackish and non-performant) would be to create an
ImageViewAsync
just to hold the result of the FFImageLoading and on the Success callback set the Drawable in theImageButton
:HIH and if you need any help let me know