center svg image android programmatically composable

36 Views Asked by At

I have svg image I want to make it center of screen. I am using Android composable.

My code is

@Composable
fun SvgDrawing() {
    val pathData = "M275 462q140 -29 316 -14q49 4 54 35q0 20 -39 92l-14 24q-14 21 -167 177q-88 89 -104 109q-91 113 -136 307l-8 34v57q0 57 4 82q24 179 153 237q94 47 233 34q141 -15 259 -104q173 -130 270 -371q15 -36 29 -39q13 0 2 47q-82 319 -289 535q-138 138 -292 169 q-192 37 -323 -50q-214 -176 -130 -555q51 -224 197 -429q50 -71 160 -193q58 -64 58 -67q0 -4 -9 -8q-182 -19 -310 29q-20 10 -49 50q-15 21 -21 27q-6 7 -14 4q-13 -10 -5 -33q4 -18 19 -42q75 -123 156 -144z"

    Canvas(modifier = Modifier.fillMaxSize()) {
        drawPath(
            path = PathParser.createPathFromPathData(pathData).asComposePath(),
        color=Color.Red,

        )
    }
}

It crop some part of svg image

enter image description here

How to align svg in center of screen without cropping image

0

There are 0 best solutions below