gpt4 book ai didi

java - 有没有办法在执行时减慢翻译动画的速度?

转载 作者:行者123 更新时间:2023-11-29 07:31:32 25 4
gpt4 key购买 nike

如何控制动画的速度?翻译动画从下到上,我想在动画执行期间放慢动画速度。我怎样才能做到这一点?这是我所拥有的:

public void SlideToAbove() {

Animation slide = null;
slide = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 0.0f);

slide.setDuration(300);
slide.setFillAfter(true);
slide.setFillEnabled(true);
toolBar.startAnimation(slide);

final Animation finalSlide = slide;
slide.setAnimationListener(new Animation.AnimationListener() {


public void onAnimationStart(Animation animation) {
}


public void onAnimationRepeat(Animation animation) {
}


public void onAnimationEnd(Animation animation) {


CoordinatorLayout.LayoutParams lp = new CoordinatorLayout.LayoutParams(
toolBar.getWidth(), toolBar.getHeight());
lp.setMargins(0, 0, 0, 0);
appBarLayout.setLayoutParams(lp);
finalSlide.setFillAfter(true);

}

});

最佳答案

试试这个,

slide =new TranslateAnimation(-100f, 0f, 0f, 0f);
slide.setDuration(600);

关于java - 有没有办法在执行时减慢翻译动画的速度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41501284/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com