I tried to make a layout translation animate with this. But it only translate layout from left to right. But I need to translate right to left. So how should I do that?
aLayout.animate()
.translationX(bLrLayout.getHeight())
.alpha(0.0f)
.setDuration(3000);
But I need to translate right to left.
just use negative number as translationX
parameter
aLayout.animate()
.translationX(-1000)
.alpha(0.0f)
.setDuration(3000);
you can do something like this
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "translationX", 0, bLrLayout.getHeight());
anim.start();
and then if you want to return back
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "translationX", bLrLayout.getHeight(), 0);
anim.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.