Different results when using RoundedDrawable/Transformation and RoundedImageView #50
Comments
Huh. I'm not sure what the issue is but you should be using |
Thanks! Setting But the problem with border width using transformation remains. Example: Enable 'Show layout bounds' in dev options, and run Grid Wichterle app with size of cell 8dp. |
Ah, I think I know what's up. When you do I don't use Ion personally but from what I remember it's similar to Picasso, so you should try copying some of the code from the Picasso fragment in the example. I think Ion had a similar Transform/Transformation class. Make sure you use the |
I tried setting drawable bounds both for original and for Rounded, but border stays the same. Yes, my Ion transformation builder is nearly the same as for Picasso. I thought there was a problem with it, but unfortunately not. |
Hm, I'm not sure in what order Ion applies its transformations, but basically it needs to apply the border after the resize, otherwise the border size will be wrong. I just tested on the Picasso example and things seem correct, so might be an issue with Ion. |
Yeah, but as I wrote problem appears without Ion too:
Same result when setting and not setting bounds. |
Why are you setting drawable bounds twice? Are they different both times? And what are you doing when you "set desired bounds"? You have to actually resize the bitmap of a BitmapDrawable into a new bitmap, otherwise RoundedDrawable just calls getBitmap and applies border to that... I guess we could try to use drawable bounds instead of bitmap bounds... But we might not be able to do that efficiently. |
I think there's a misunderstanding of drawable vs bitmap here. RoundedDrawable operates on the source bitmap, not the drawable. So drawable bounds don't matter, and when you set a Drawable into an ImageView, the bounds are set for you anyway. What you want to do is to resize the bitmap. Picasso's |
I am not able to fit the entire image inside the imageview. Only a portion of the image is displayed inside the imageview. What should be done to fit the entire image inside? |
I'm trying to draw people photos in circle (like in G+)
If I define RoundedImageView in xml:
With next parameters:
Photo is drawn as expected (photo 3).
But if I'm trying to load image using Ion+Transformation or from RoundedDrawable
Photo is drawn not in circle, but as rectangle with rounded corners. Also, you may notice, that width of border is also different for circle and rectangle.
Example:
First is using RoundedDrawable, second is using Ion transformation and third is RoundedImageView
I tried setting bounds for drawables but that didn't help me.
I can provide whole test project.
I can solve this issue by defining bigger radius when using transformation, but it seems weird for me.
The text was updated successfully, but these errors were encountered: