Skip to content Skip to sidebar Skip to footer

Custom Shaped Layout With Clipping Bounds

Well yes, I couldn't find anything that could help me for real so far... from StackOverflow to libraries and other things... I need a custom shaped FrameLayout that is clipping hi

Solution 1:

You can use clip path. Your code can look something like:

private void updatePath() {
    path = new Path();
    // Draw your special shape...
}

@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    canvas.clipPath(path);
    return super.drawChild(canvas, child, drawingTime);
}

@Override
protected void onDraw(Canvas canvas) {
    canvas.clipPath(path);
    super.onDraw(canvas);
}

Post a Comment for "Custom Shaped Layout With Clipping Bounds"