Android 动画-停止动画并显示动画中的特定图像
如何停止动画(我认为是使用.stop()。然后它应该是一幅静止的动画画面。第二张图片应为所示图片 我该怎么做 以下是XML动画列表:Android 动画-停止动画并显示动画中的特定图像,android,xml,animation,Android,Xml,Animation,如何停止动画(我认为是使用.stop()。然后它应该是一幅静止的动画画面。第二张图片应为所示图片 我该怎么做 以下是XML动画列表: <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/app" androi
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/app" android:duration="1200"/>
<item android:drawable="@drawable/app2" android:duration="250"/>
</animation-list>
经过几个小时的研究,我自己解决了这个问题
Object tag = layout.getTag();
int backgroundId = R.drawable.night;
if( tag != null && ((Integer)tag).intValue() == backgroundId) {
backgroundId = R.drawable.day;
playAnimation();
}
else
{
animatedLoerg.selectDrawable(1);
animatedLoerg.stop();
}
layout.setTag(backgroundId);
layout.setBackgroundResource(backgroundId);
用标签解决了