android怎么画圆角的矩形 如果你是在自定义view的onDraw方法中:RectF rectF=new RectF(100,100,500,500);先画一个矩形Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);创建画笔paint.setColor(R.color.colorAccent);添加画笔颜色canvas.drawRoundRect(rectF,30,30,paint);根据提供的矩形为四个角画弧线,(其中的数字:第一个表示X轴方向大小,第二个Y轴方向大小。可以改成其他的,你可以自己体验),最后添加画笔。如果你是在布局中直接添加,楼上已经做出方法,我就不举例了。
怎么用canvas在bitmap上画个边框? Bitmapoutput=Bitmap.createBitmap(bitmap.getWidth(),bitmap.getHeight(),Config.ARGB_8888);Canvas canvas=new Canvas(output);final Paint paint=new Paint();final Rect rect=new Rect(0,0,bitmap.getWidth(),bitmap.getHeight());final RectF rectF=new RectF(rect);paint.setAntiAlias(true);canvas.drawARGB(0,0,0,0);canvas.drawRoundRect(rectF,20.0f,20.0f,paint);paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));canvas.drawBitmap(bitmap,rect,rect,paint);return output;
用canvas画只有一个角是圆角的矩形,能画出来么 您好,您用用这个方法:float[]radii={12f,12f,0f,0f,0f,0f,0f,0f};path.addRoundRect(new RectF(0,0,50,50),radii,Path.Direction.CW);canvas.drawPath(path,paint);
android图片圆角怎么简单高效实现?