0

どうすればアニメーションを停止できますか (私は .stop() で考えます)。次に、アニメーションの画像が静的に表示されるはずです。2 番目の画像は、表示されているものである必要があります。

それ、どうやったら出来るの?

XMLアニメーションリストは次のとおりです。

 <?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>
4

1 に答える 1

0

数時間の調査の後、私は自分でそれを解決しました。

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); 

タグで解決しました。

于 2012-12-28T17:13:37.950 に答える