Mark Murphy wrote:
> Rotate with unknown pivot. If you're seeing a rotation around the center
> point of the View with the parameters I gave you, then obviously there's
> something a wee bit off with my View.
>
> Hmmm...I have paddingRight and paddingTop values in the layout for this
> ImageView. I wonder if the animation is taking those into account. That
> would explain why 10, 20 would be close to the correct values when I
> hard-wired them in -- the 20 would be the 10px paddingTop plus roughly
> half of the image itself.

ok, i found it.

animation stuff works OK: it rotates tho whole view (not image
bounds), run hierarchyviewer and
you'll see that pivot is ok.

if you try to rotate image itself, try this

ImageView iv = (ImageView) findViewById(R.id.iv);
Matrix matrix = iv.getImageMatrix();
RectF dst = new RectF();
matrix.mapRect(dst, new RectF(iv.getDrawable().getBounds()));
Log.d("Test", "Dst " + dst);
RotateAnimation a = new RotateAnimation(0, 360, iv.getPaddingLeft() +
dst.centerX(), iv.getPaddingTop() + dst.centerY());
a.setDuration(5000);
iv.startAnimation(a);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to