My application is used in landscape orientation. What I want to do is move an element from off the screen at all until it enters the screen and then when pressing a button, it leaves the screen again by scrolling to the left.
How to make animation using ObjectAnimator?
454 views Asked by UyerBit At
2
There are 2 answers
0
On
The animation starts from the default position of the view (i.e the position you have specified in your xml file). if you do not what the animation to start from that position, you can either:
change the initial position of the view in the xml file.
or set the x and y coordinates of the view at run time and then start your animation like so:
ObjectAnimator translateX = ObjectAnimator.ofFloat(view, "translationX", deltaX);
All you need is a TranslationX animation, see below, or check out this link. https://developer.android.com/training/animation/reposition-view
If you have any question, please feel free.:)