简体   繁体   中英

How to set round corner image from bitmap (get image string from server)

i have tried this code image rounder perfectly but rounded image can not focus my face!!! any body help me?

//Bitmap mbitmap = ((BitmapDrawable) getResources().getDrawable(R.drawable.cat)).getBitmap();
  Bitmap imageRounded = Bitmap.createBitmap(result.getWidth(), result.getHeight(), result.getConfig());
  Canvas canvas = new Canvas(imageRounded);
  Paint mpaint = new Paint();
  mpaint.setAntiAlias(true);
  mpaint.setShader(new BitmapShader(result, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
  canvas.drawRoundRect((new RectF(0, 0, 258, 250)), 120, 120, mpaint);// Round Image Corner 100 100 100 10

  // ivPhoto.setImageBitmap(result);
  ivPhoto.setImageBitmap(imageRounded);

If only a rounded imageview is what you're looking for then a CircularImageView might help you, it also supports the .setimageBitmap() method

Check this library . Its pretty easy to use.

使用这个库 ,有很多定制的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM