Paint p = new Paint();
p.setAntiAlias(true);
p.setColor(Color.DKGRAY);
int y=getWindowManager().getDefaultDisplay().getWidth();
Config conf = Bitmap.Config.RGB_565;
Bitmap bmp =Bitmap.createBitmap(y,y,conf);
Canvas c = new Canvas(bmp);
c.drawCircle(y/2 ,y/2, y/3, p);
iv.setBackgroundDrawable(new BitmapDrawable(bmp));
By this code i do get circle ,which is looking as:-

Now the problem is that it doesnt look like a true circle ,and it looks like an oval shape..
So what should i do ??
Thanks in advance,....
iv.setBackgroundDrawable(new BitmapDrawable(bmp));
use setImageBitmap(), instead of setBackgroundDrawable(), and setScaleType() to FIT_CENTER
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With