Tuesday, September 11, 2012

[android-developers] How to rotate the image to counter clockwise direction

Hi all,
I'm trying to rotate the imageView by using following function:
---------------------------------------------------------------------------------------------------------------------------------------------------------------
private void OrientationChanged(int _prev, int _new){
        ImageView _imgVw = (ImageView) findViewById(R.id.imageView1);
        RotateAnimation r = new RotateAnimation(_prev, _new, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        r.setDuration(1000);
        r.setFillAfter(true);
        _imgVw.startAnimation(r);
}

I implemented the code to get the right degree of the phone when the phone's orientation has changed.
And above is working well when the phone's orientation has changed with clockwise direction.
But when the phone's orientation has changed to counter clockwise direction above module is not working.
I was trying to implement more code to make the minus degree or formula but failed.

Do you think I have to use Matrix to establish this?

I don't know for sure how to make a code for counter clockwise rotation.
Please help me with this.

Thanks.

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

No comments:

Post a Comment