public class RoundCornerView extends View{
public RoundCornerView(Context context) {
super(context);
}
public RoundCornerView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public RoundCornerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
protected void onDraw(android.graphics.Canvas canvas)
{
Paint paint = new Paint();
paint.setAlpha(255);
canvas.translate(0, 30);
paint.setColor(Color.BLUE);
Path mPath = new Path();
mPath.addRoundRect(new RectF(0, 0, 100,100),20,20, Path.Direction.CCW);
canvas.clipPath(mPath, Region.Op.INTERSECT);
paint.setColor(Color.GREEN);
paint.setAntiAlias(true);
canvas.drawRect(0, 0, 120,120,paint);
}
}
Try to use clippath, but just as a side note after 3.0 you need to turn off hardwareAccelerated in you're manifest
android:hardwareAccelerated="false"
There are solutions for that, when founded will post it here as an addition