我怎么能重复过渡下去吗? [英] How can I repeat a transition forever?

查看:205
本文介绍了我怎么能重复过渡下去吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个过渡看起来像这样:

I have a transition looking like this:

<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:drawable="@drawable/divider"/>
    <item android:drawable="@drawable/divider_active"/>

</transition>

和code看起来像这样:

and Code looking like this:

View divider = v.findViewById(R.id.divider);
if (divider != null) {
  TransitionDrawable transition = (TransitionDrawable) divider.getBackground();
  transition.startTransition(2000);
}

我的问题是,我不知道该怎么永远重复这种转变,所以我可以创建一个脉冲的效果。

My problem is, I don't know how to repeat this transition forever, so I can create a pulsing effect.

编辑:

为了让事情变得清楚:在code创建一个视图(列表项)时被执行,所以循环是无解的。

To make things clear: The code gets executed when creating a view (listitem), so loops are no solution.

推荐答案

我认为你应该使用AnimationDrawable代替TransitionDrawable:的http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

I think you should use AnimationDrawable instead of TransitionDrawable: http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

这篇关于我怎么能重复过渡下去吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆