I tried to animate View’s position in a RelativeLayout. In every frame I change the topMargin of the View’s LayoutParams and then call View#setLayoutParams(newParams).
The animation is unfortunately too slow because the setLayoutParams() call triggers remeasuring of the whole View tree.
How can I solve this without using API 11+?
You can use View Animations Just make yourself an xml file with a translate animation in it that defines how you’d like your View to move. Then inflate a reference to your Animation and call
Here is an example of a translate xml file. You’d save a file like this in res/anim/
Here is what you’d do in java to use it.