Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
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 answers
Answer question

0

You can use DrawScope.translate:

translate(left = 10f, top = 10f) {
    with(painter) {
        draw(
            painter.intrinsicSize
        )
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!