Crop Image as circle in Android

前端 未结 6 901
不思量自难忘°
不思量自难忘° 2020-12-16 02:30

Does anyone know how to crop an image\\bitmap to a circle? I can not find any solution, sorry ..

6条回答
  •  别那么骄傲
    2020-12-16 03:13

    finalBitmapShader shader = newBitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
    mPaint.setShader(shader);
    mBitmapWidth=mBitmap.getWidth();
    mBitmapHeight=mBitmap.getHeight();
    }
    @Override
    public void draw(Canvas canvas{ 
      canvas.drawOval(mRectF,mPaint);
    }
    @Override
    protected void onBoundsChange(Rect bounds) {
      super.onBoundsChange(bounds);
      mRectF.set(bounds);
    }
    

    here I found a sample tutorial of it at http://androidgreeve.blogspot.in/2014/09/facebook-messanger-like-profile-image.html?m=1

提交回复
热议问题