Custom Imageview Class Not Working With Picasso Image Downloading Library
I have recently extended from an ImageView to create a CircularImageView class which makes the image circular with a coloured border. This is done via the onDraw(canvas) method by
Solution 1:
For circular images using Picasso, use this class that implements Transformation.
Picasso.with(context).load(url).transform(new RoundedTransformation(radius, margin)).into(imageview);
Solution 2:
When doing this with Picasso you should either:
- Apply the rounding as a
Transformationso that the rounded bitmap is cached in memory, or - Clamp the canvas with a shader in a custom
ImageViewsubclass. Details on this technique were outlined by the ragin' cagin' Romain Guy on his blog
Trying to pull the underlying Bitmap out of an ImageView is an anti-pattern. If you do need access to a Bitmap (and you don't, you should use one of the above), implement Target on your view whose onBitmapSuccess callback will provide it.
Post a Comment for "Custom Imageview Class Not Working With Picasso Image Downloading Library"