0

I'm using a custom View so the user can draw on the screen. I'm using the Path class and everything works out.

When the orientation change, the custom View width and height changes too. My question would be if there is a way to scale the path according to the new View size, and position it relatively too.

PS: for anyone wondering how did I save the path for orientation change, all credits to Rabie Jradi how to serialize an object of android.graphics.Path

Community
  • 1
  • 1
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206

1 Answers1

1

You can use this to scale path.

Matrix scaleMatrix = new Matrix(); scaleMatrix.postResize(orginalWidth/currentWidth, orginalHeight/currentHeight); path.transform(scaleMatrix);

Onur
  • 5,617
  • 3
  • 26
  • 35