0

我有一个看法。我想将其 alpha 从 1 更改为 0,然后重复多次。我相信我必须为此使用动画。但我不知道如何在 android 中使用 CycleInterpolator。有人可以给我看一个代码示例吗?我已经做到了

CycleInterpolator ci = new CycleInterpolator(5f);
ViewPropertyAnimator anim = myView.animate();
anim.alpha(0);
anim.setDuration(10000);
anim.setInterpolator(ci);

编辑

上面的代码有效,但它非常轻快。我看到的只是闪烁。我希望视图淡出,然后非常缓慢地恢复,大约每秒或两三秒一次。我真的需要过渡平滑、缓慢且肉眼可见。

4

1 回答 1

0

你有没有尝试过

myview.animate().alpha(0).setInterpolator(new CycleInterpolator(<Number of cycles>))

您还可以在ViewPropertyAnimator 此处找到 a 的所有不同方法。

于 2013-10-03T21:49:52.900 回答