闪烁动画计数:如何仅将TextView闪烁三次

时间:2014-12-02 10:21:59

标签: android

如何仅将TextView三次闪烁。

我尝试了这段代码,但它没有用。

伙计我有一个textview,我需要它才能闪烁。

anim.setDuration(150);
anim.setStartOffset(50);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(3);

MainScreenActivity.txtNext.startAnimation(anim);
blinking=true; 

1 个答案:

答案 0 :(得分:1)

这是一个可用于闪烁视图的xml

<强> blink.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
    <alpha
        android:fromAlpha="1"
        android:toAlpha="0"
        android:repeatCount="3"
        android:repeatMode="reverse"
        android:interpolator="@android:interpolator/linear"
        android:duration="150"
        />
</set>

您可以像这样调用此动画:

MainScreenActivity.txtNext.startAnimation(AnimationUtils.loadAnimation(MainScreenActivity, R.anim.blink))
相关问题