【发布时间】:2018-10-25 06:07:23
【问题描述】:
我想通过点击它的行来显示/从右到左/从左到右动画的按钮, 这是我将其设置为可见的代码:
button.setVisibility(View.VISIBLE);
TranslateAnimation animate = new TranslateAnimation(button.getWidth(),0,0,0);
animate.setDuration(500);
animate.setFillAfter(true);
button.startAnimation(animate);
一去不复返:
TranslateAnimation animate = new TranslateAnimation(0,button.getWidth(),0,0);
animate.setDuration(500);
animate.setFillAfter(true);
button.startAnimation(animate);
默认情况下,按钮已消失。第一次,当我单击该行时,按钮变得可见但没有动画。之后它可以正常工作。为什么第一次动画不起作用??
【问题讨论】:
标签: android animation visibility