繁体   English   中英

如何停止淡出textview的动画?

[英]How to stop fading animation of textview?

我使用库com.tomer.fadingtextview来淡出动画的textview它正常工作,但我想在几秒钟后停止该动画。 我该怎么办 ?

activitymain.xml

 <com.tomer.fadingtextview.FadingTextView android:id="@+id/headline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="150dp" android:fontFamily="@font/goingforward" android:textColor="@color/Denim" app:texts="@array/title" android:textStyle="bold" android:textSize="40sp" android:textAllCaps="false" app:timeout="500"/> 

您可以使用以下方式在几秒钟后停止TextView animation

new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                fadingTextView.stop();
            }
        }, Time_TO_STOP);

如果你想停止动画一段时间然后使用计时器..

    new Timer().schedule(new TimerTask() {          
    @Override
    public void run() {
        // this code will be executed after 2 seconds 
        textview.clearAnimation();    
    }
}, 2000);

您可以使用我的库为视图设置动画,您可以使用FadeAnimation淡化任何视图并链接到其他动画。 https://github.com/ZachBublil/Choreographer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM