[英]Translate Layout left to right
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只需使用负数作为
translationX
参数
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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.