I've seen Udacity lectures about Material Design and there was mentioned usage of RoundedBitmapDrawable to achieve circular view. However I have some troubles to make it work with Picasso.
I'm not sure how exactly Picasso works, but I have large, nonsquare image in file storage. Therefor I use Picasso as follows:
Picasso.with(context).load(f).resize(densityDpi, densityDpi).centerInside().transform(new Transformation() {
@Override
public Bitmap transform(Bitmap source) {
Log.d("jano", "transformation running");
RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(context.getResources(), source);
drawable.setCircular(true);
drawable.setCornerRadius(source.getWidth() / 2.0f);
return drawable.getBitmap();
}
@Override
public String key() {
return "circle";
}
}).into(imageView);
Images are however squared without rounded corners (should be circular). And That is what I want to achieve.
Is there any simple way to achieve this with RoundedBitmapDrawable or do I have to fully implement transformation? (which I have seen on StackOverflow)
Please do not submit answer without description why it cannot be used. I only want to know about combination of these 2 items (Picasso, RoundedBitmapDrawable)
You could use google IO app's BezelImageView which works well with the Picasso library, just add this class to your project and you can directly start using it like any other imageview, but bezelImageView has 2 extra options to specify the circle border color, and the mask drawable. Link to source code here .
BezelImageView.java
Usage in layout.
circle_blue.xml
circle_stroke_only.xml