开发者

Rotating a view

开发者 https://www.devze.com 2023-02-22 06:49 出处:网络
I am making a library that accept Views as input. I want to rotate those views... since they are a input, I cannot inherit from then to do a onDraw override...

I am making a library that accept Views as input.

I want to rotate those views... since they are a input, I cannot inherit from then to do a onDraw override...

So, how I rotate a view? (for example to display it at 23.589235 degrees)

If 开发者_StackOverflownot possible to do it without overriding onDraw, there are a way in Java to achieve that effect without inheriting from View class?

EDIT: If possible, it would be nice if the solution worked on 1.5 (where I live 1.5 is still common)


Edit:

Let's try this again.

While the transformation methods are not available until API Level 11, the Animation API is available since Level 1. So I would suggest applying Animations with a duration of 0.

Original ridiculous, wrong answer:

You should really look at the methods available in View. setRotationX() and setRotationY() are among them, along with a bunch of other transformation methods.

http://developer.android.com/reference/android/view/View.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号