I have a layout that contains two image buttons, two spaces and two text views. My activity is required to be locked in the landscape orientation, and the buttons are rotated on orientation change. This is done with RotateAnimation with code like this:
anim = new RotateAnimation(start, end, elem.getWidth() / 2, elem.getHeight() / 2);
anim.setDuration(400);
anim.setInterpolator(new AccelerateInterpolator(1.0f));
anim.setFillAfter(true);
The animations are created and started in onOrientationChange
listener with elem.startAnimation(anim)
. This works fine most of the time. The problem appears on devices with Android 4.4.4 and 4.2 (on 5.0.2 this does not occure). This is what happens:
- I change orientation to anything other than landscape
- the buttons rotate as usual, the rotation is correct
- when I press any of theese buttons, the other one resets its rotation to the original, landscape value instantly and stays that way until I change the orientation again
I wonder if this is a Android bug, since it does not happen on Lollipop. I wonder even more if this could be resoleved or worked around somehow.
Can someone help me with this issue?