
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(output); final int color = 0xff424242; 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); paint.setColor(color); canvas.drawRoundRect(rectF, roundPx, roundPx, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(bitmap, rect, rect, paint); return output; } 查看原帖>>
int x = 10; int y = 10; int width = 300; int height = 50; float[] outerR = new float[] { 12, 12, 0, 0, 0, 0, 30, 30 }; RoundRectShape rectShape=new RoundRectShape(outerR, null, null); ShapeDrawable mDrawables= new ShapeDrawable(new RoundRectShape(outerR, null,null)); mDrawables.getPaint().setColor(Color.RED); mDrawables.setBounds(x, y, x + width, y + height); mDrawables.draw(canvas);费了九牛二虎之力终于找到点踪迹了,基本上搞定 查看原帖>>
int x = 10; int y = 10; int width = 300; int height = 50; float[] outerR = new float[] { 12, 12, 0, 0, 0, 0, 30, 30 }; RoundRectShape rectShape=new RoundRectShape(outerR, null, null); ShapeDrawable mDrawables= new ShapeDrawable(new RoundRectShape(outerR, null,null)); mDrawables.getPaint().setColor(Color.RED); mDrawables.setBounds(x, y, x + width, y + height); mDrawables.draw(canvas);费了九牛二虎之力终于找到点踪迹了,基本上搞定
int x = 10; int y = 10; int width = 300; int height = 50; float[] outerR = new float[] { 12, 12, 0, 0, 0, 0, 30, 30 }; RoundRectShape rectShape=new RoundRectShape(outerR, null, null); ShapeDrawable mDrawables= new ShapeDrawable(new RoundRectShape(outerR, null,null)); mDrawables.getPaint().setColor(Color.RED); mDrawables.setBounds(x, y, x + width, y + height); mDrawables.draw(canvas);费了九牛二虎之力终于找到点踪迹了,基本上搞定 查看原帖>>
