-
Notifications
You must be signed in to change notification settings - Fork 377
Custom ViewTarget
Yauheni Pakala edited this page Jan 2, 2020
·
1 revision
Example add a custom target for the custom view.
SubsamplingScaleImageView - A custom image view for Android, designed for photo galleries and displaying huge images.
using FFImageLoading.Drawables;
using FFImageLoading.Targets;
using FFImageLoading.Work;
namespace FFDroidTargetDemo
{
using Com.Davemorrissey.Labs.Subscaleview;
public class SubsamplingScaleImageViewTarget
: ViewTarget<SubsamplingScaleImageView>
{
public SubsamplingScaleImageViewTarget(
SubsamplingScaleImageView imageView)
: base(imageView)
{
}
public override void Set(
IImageLoaderTask task,
SelfDisposingBitmapDrawable image,
bool animated)
{
var source = ImageSource.ForBitmap(image.Bitmap);
Control.SetImage(source);
}
}
}
var target = new SubsamplingScaleImageViewTarget(_imageView);
ImageService.Instance
.LoadUrl("image-url")
.IntoAsync(target);