我有一个TextView,可通过以下方式在其上应用动画:
TextView txtStatus = (TextView) view.findViewById( R.id.txtStatus );
Animation animation = new Animation()
{
@Override
protected void applyTransformation( float interpolatedTime, Transformation t )
{
Log.d( "Debug", "ALPHA: " + interpolatedTime );
}
};
animation.setDuration( 700 );
txtStatus.clearAnimation();
txtStatus.startAnimation( animation );
问题在于,无论出于什么原因,第二次调用动画时,动画都短得多,并直接跳到0.9,而不是逐渐增大。
这也很奇怪,它大约有50%的时间发生。
输出示例:
First time executed:
ALPHA: 0.0
ALPHA: 0.0
ALPHA: 0.005809784
ALPHA: 0.022434622
ALPHA: 0.034290344
ALPHA: 0.049515605
ALPHA: 0.066241235
ALPHA: 0.086459756
ALPHA: 0.10768908
ALPHA: 0.13245812
ALPHA: 0.15936571
ALPHA: 0.18650392
ALPHA: 0.21710521
ALPHA: 0.24741328
ALPHA: 0.3159377
ALPHA: 0.38655293
ALPHA: 0.45965204
ALPHA: 0.53363454
ALPHA: 0.5715612
ALPHA: 0.64379966
ALPHA: 0.7128896
ALPHA: 0.74479985
ALPHA: 0.8082236
ALPHA: 0.83567554
ALPHA: 0.8866831
ALPHA: 0.90971905
ALPHA: 0.94752276
ALPHA: 0.962368
ALPHA: 0.9859218
ALPHA: 0.9931222
ALPHA: 0.9999194
ALPHA: 1.0
ALPHA: 1.0
Second time executed:
ALPHA: 0.0
ALPHA: 0.0
ALPHA: 0.90318537
ALPHA: 0.9292244
ALPHA: 0.94752276
ALPHA: 0.96321744
ALPHA: 0.9762169
ALPHA: 0.98644567
ALPHA: 0.99798715
ALPHA: 1.0
ALPHA: 1.0
请问有人提示我做错了什么?谢谢!