2012-04-07 78 views
0

我已經使用AnimationDrawable顯示了六個圖像。它成功地動畫。在Android中需要動畫幫助

但它只動畫相同的地方。

但我需要前進,當下一幀顯示。我如何顯示它。

我的代碼。,

<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> 
<item android:drawable="@drawable/frog" android:duration="50" /> 
<item android:drawable="@drawable/frog1" android:duration="50" /> 
<item android:drawable="@drawable/frog2" android:duration="50" /> 
<item android:drawable="@drawable/frog3" android:duration="50" /> 
<item android:drawable="@drawable/frog4" android:duration="50" /> 
<item android:drawable="@drawable/frog5" android:duration="50" /> </animation-list> 




private void animate() { 
     ImageView imgView = (ImageView) findViewById(R.id.animationImage); 
     // imgView.setVisibility(ImageView.VISIBLE); 
     imgView.setBackgroundResource(R.drawable.ani); 


     AnimationDrawable frameAnimation = (AnimationDrawable) imgView 
        .getBackground(); 

     if (frameAnimation.isRunning()) { 
       frameAnimation.stop(); 
       b.setText("Start"); 

     } else { 
       frameAnimation.start(); 
       b.setText("Stop"); 
     } 
    } 

表示下一幀時,它前進位置。請幫助我。

+0

你也可以看到http://stackoverflow.com/questions/8386449/android-text-animation – pengwang 2012-04-11 09:34:00

回答