Android 如何制作平滑的alpha动画

Android 如何制作平滑的alpha动画,android,android-animation,Android,Android Animation,我有一个简单的alpha动画应用于TextView: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" > <alpha android:duration="2000" andro

我有一个简单的alpha动画应用于
TextView

 <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator" >

<alpha
    android:duration="2000"
    android:fromAlpha="1.0"
    android:repeatCount="infinite"
    android:toAlpha="0.1" />


动画结束后,alpha值再次从0.1跳到其默认值(1.0)。如何实现
TextView
平滑淡入淡出?

如果有人感兴趣:我通过向集合中添加一个alpha项(具有相反的值)来解决这个问题。这将导致平滑的淡入/淡出

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator" >

<alpha
    android:duration="2000"
    android:fromAlpha="1.0"
    android:repeatCount="infinite"
    android:toAlpha="0.2" />
<alpha
    android:duration="2000"
    android:fromAlpha="0.2"
    android:repeatCount="infinite"
    android:toAlpha="1.0" />


我知道这个答案出现得很晚,但对于那些面临同样问题的人,我想分享一下这个简单的解决方案:

android:repeatMode="reverse"

动画属性的反转应该会导致平滑淡入动画,而不需要第二个alpha项。

对我有效的是添加:

android:hardwareAccelerated="true"

并最小化我的应用程序背景图像的文件大小。

尝试了此操作后,动画仍然会出现口吃。感谢您的帖子,但即使使用8KB的图像文件,动画仍然无法平滑。