Drawing Custom Shapes in Android | raywenderlich.com

Learn how to draw custom shapes and paths in Android by creating a neat curved profile card with gradient colors.

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9556022-drawing-custom-shapes-in-android

I have made shape using your tutorial but when I add shadow above it then it is not drawing properly using the below code

private fun drawBackgroundShadow(canvas: Canvas, bounds: RectF, avatarBounds: RectF) {
val paint = Paint()
paint.color = shadowColor

    val backgroundPath = Path().apply {
        moveTo(bounds.bottomLeft.x, bounds.bottomLeft.y)

        lineTo(avatarBounds.centerLeft.x, avatarBounds.centerLeft.y)

        arcTo(avatarBounds, -180f, 180f, false)

        lineTo(bounds.bottomRight.x, bounds.bottomRight.y)


    canvas.drawPath(backgroundPath, paint)

val shadowBounds = RectFFactory.fromLTWH(0f, 0f, width, height - avatarRadius + 10f)

    drawBackgroundShadow(canvas,shadowBounds, avatarBounds)

Can you please help me??