简体   繁体   English

从左到右翻译布局

[英]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.

相关问题 布局标签从左到右 - Layout labels from left to right 聊天布局的左侧和右侧与包装的背景对齐 - Chat layout left and right align with wrapped background 隐藏JSplitPane的左/右组件(或其他布局) - Hide left/right component of a JSplitPane (or different layout) JavaFX BorderPane 布局(拉伸左右窗格) - JavaFX BorderPane Layout (Stretch Left and Right Pane) 如何沿着Java形状行走并将其转换为左/右/直命令? - How to walk along a Java shape and translate it to left/right/straight commands? 如何以编程方式将相对布局中的视图与最左,最中和最右对齐? - How to align views in a relative layout to far left, center, and far right programmatically? 为什么将layout_gravity设置为left / right在水平LinearLayout中不起作用? - Why does layout_gravity set to left/right have no effect in horizontal LinearLayout? 我需要将 ListView 锚定到约束布局的顶部、底部、左侧和右侧边缘 - I need to Anchored the ListView to the top, bottom, left, and right edges of the constraint layout 我希望将线性布局中的一个(左侧或右侧,取决于用户的选择)替换为自定义的线性布局 - i want one (left or right side depending on user's choice)of the linearlayout to be replaced with a custom Linear layout 在 android 布局中放置三角形,并在左侧和右侧放置另一个三角形 onClick() - Place triangles in android layout and put another triangle on left and right side onClick()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM