android - 如何知道 TextView 是否在动画中?

标签 android textview

在 onClickListener 上,我在 textView(图标)上开始动画

Animation anim = AnimationUtils
          .loadAnimation(activity.getBaseContext(), R.anim.rotate_refresh);
icon.startAnimation(anim);

再次点击时,我想检查图标是否在动画(旋转),保持这种状态,否则再次开始动画。

我想知道如何检查动画中的textview?

最佳答案

也许试试这样的东西

Animation animation = icon.getAnimation();
if(animation != null && animation.hasStarted() && !animation.hasEnded()){
    //do what you need to do if animating
}
else{
    //start animation again
}

关于android - 如何知道 TextView 是否在动画中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29250714/

相关文章:

android - TextView 没有及时更新

android - 如何理解两个在线视频: RTSP and HTTP?的区别

android - Android Studio 布局编辑器中引发的异常

android - Android 前台服务说明

android - Context.startForegroundService() 仅在 Android 11 Samsung 设备上没有调用 Service.startForeground()

android - Canvas.drawText为小文本尺寸(1px)添加额外的字母空间

android - 如何更改Android TextView的省略号字符串?(... to ...more)

每个 Activity 的 Android Tabbar 都会给出 java.lang.StackOverflowError

java - 在 TextView 中显示的转义字符

Android TextView 对齐文本