I have a layout with an image on it (built-in to ImageView). I need to rotate the image (say) 90 degrees CCW.
I wrote code for animating the rotation of the image ...:
public class MainActivity extends Activity
{
private ImageView mImageView = null;
private Animation mRotateAnimation = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mImageView = (ImageView) findViewById(R.id.my_image);
mRotateAnimation = AnimationUtils.loadAnimation(this, R.anim.my_rotate_90);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
mImageView.startAnimation(mRotateAnimation);
return true;
}
return super.onTouchEvent(event);
}
}
The image rotates smoothly 90 degrees, but then returns to its original state. This is what the Android documentation says will happen after the animation finishes. Presumably, in the animation completion notification, I should transform the ImageView (or the base drawing) and possibly invalidate it to cause a redraw.
All is well and good, except that I cannot find a way to do this, and I cannot find examples of who else is doing this .
getImageMatix/setImageMatrix mImageView . Drawable, , setDrawable() ImageView, , .
; ( LunarLander), ImageView, .
, - ... aaaargh, ImageView ?
.