i used below single line code for animation to my image view in android.
Coding
v.animate().translationXBy(1000).setDuration(5000).start();
but i hides the image. i don't want to hide my image using the above source. any helps are much welcome thanks.
Try this:
v.bringToFront();
Add this before animating.
Hope this helps
how do you want to hide your image?
you can also hide it by set 0 in alpha attribute
v.animate().alpha(0).setDuration(500).start();
EDIT
To move the view right to left without hide it at the end
You can try to use v.animate.x() instead
int minXPosition = 0;
int moveXBy = 100;
int newXPosition = (int)view.getX()-moveXBy;
view.animate() .x(newXPosition<minXPosition?minXPosition:newXPosition) .setDuration(500) .start();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.