Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
Jetpack Compose offset image vector in Canvas

I have a problem with vector image in Canvas. As shown below I can just call vector image but I can’t make any offset in Canvas. So I only can have it the way it is.

I don't know the reason why there is no Offset option like in drawCircle or drawRect, if someone has some ideas it would be great.

val vector = ImageVector.vectorResource(id = R.drawable.ic_test)
val painter = rememberVectorPainter(image = vector)

Box(contentAlignment = Alignment.Center) {
    Canvas(
        modifier = Modifier
            .fillMaxWidth()
            .padding(10.dp)
    ) {
            with(painter) {
                draw(
                    painter.intrinsicSize
                )
            }

        }
    }

I tried something like adding Offset into with(painter) but nothing changes:

with(painter) {
    draw(
        painter.intrinsicSize
    )
    Offset(x = 10f, y = 10f)
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use DrawScope.translate:

translate(left = 10f, top = 10f) {
    with(painter) {
        draw(
            painter.intrinsicSize
        )
    }
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda