Rotating Image on A canvas in android

前端 未结 6 1164
心在旅途
心在旅途 2020-11-27 13:33

I want to Rotate Image according to a specific angle in android ,some thing like a compass...

I have this code...it works on drawPath() but i want to replace the pat

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 14:11

    You have to rotate the canvas first and then draw whatever you want. Then the object drawn will be appeared as rotated on screen.

    canvas.rotate(45); // degrees to rotate
    

    try this its good way.

    Check this tutorial you will get information about how to draw bitmap and how to rotate canvas

    Check complete tutorial

提交回复
热议问题