1

Resizing ImageView after circle cropping

view story
linux-howto

http://stackoverflow.com – I've got some rectangular images I'm trying to crop down in to circular ImageViews without distortion. I've created a custom ImageView and here's the onDraw() method protected void onDraw(Canvas canvas) { Drawable drawable = getDrawable(); if (drawable == null) { return; } if (getWidth() == 0 || getHeight() == 0) { return; } Bitmap b = ((BitmapDrawable) drawable).getBitmap(); Bitmap bitmap = b.copy(Bitmap.Config.ARGB_8888, true); int w = getWidth(), h = getHeight(), radius = 0; if (w < h) { radius = w; } else { rad (HowTos)