I want to draw a view like the image below, but I ...
# compose
l
I want to draw a view like the image below, but I don’t know how. The text is centered, and the length of the dotted line must be filled to fit the screen size.
c
Create a dashed line composable
Copy code
@Composable
private fun DashedLine() {
    Canvas(modifier = Modifier.fillMaxWidth()) {
        drawLine(
            color = Color(0xff212121),
            start = Offset(0f, 0f),
            end = Offset(size.width - 1, 0f),
            strokeWidth = 6f,
            pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f),
        )
    }
}
and then just have a Row { DashedLine Text DashedLine } and apply a weight modifier to the dashed lines of 1f
👍 1