【发布时间】:2017-11-19 13:15:32
【问题描述】:
我目前使用的代码:
TranslateAnimation mAnimation = new TranslateAnimation(
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 1.0f);
mAnimation.setDuration(2000);
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setInterpolator(new LinearInterpolator());
imageView.setAnimation(mAnimation);
这里是result.(忽略画质,我改一下)。
我将图像放置在水平中心,与浮动操作按钮垂直对齐。我希望它从那里开始。
另外,可选地,我创建了一个淡入淡出AlphaAnimation。如何同步它们?
AlphaAnimation 代码:
AlphaAnimation blinkAnimation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
blinkAnimation.setDuration(1000); // duration - half a second
blinkAnimation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
blinkAnimation.setRepeatCount(5000); // Repeat animation infinitely
blinkAnimation.setRepeatMode(Animation.REVERSE);
【问题讨论】:
标签: android android-animation translate-animation