2012-04-07 4 views
0

저는 AnimationDrawable을 사용하여 6 개의 이미지를 표시했습니다. 그것은 성공적으로 애니메이션되었습니다.안드로이드의 애니메이션에 대한 도움이 필요합니다.

하지만 같은 장소에서만 움직입니다.

하지만 다음 프레임이 표시 될 때 앞으로 이동해야합니다. 어떻게 보여줄 수 있습니까?

내 코드입니다., 다음 프레임을 표시 할 때, 앞으로 위치를 이동

<?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"); 
     } 
    } 

. Pls 날 도와 줘요.

+0

당신은 또한 볼 수 있습니다 http://stackoverflow.com/questions/8386449/android-text-animation – pengwang

답변

0

난 당신이 http://obviam.net/index.php/sprite-animation-with-android/ 코드를 수정하고 소스를 실행하면 차이 장소

의 그림, 당신은 마지막 그림이 필요하다 볼 수 있도록 위치를 이동할 수 있습니다한다고 생각합니다. 그림을 통해 동일하지만 그린 마스크를 실행 move.the 녹색 효과가 필요합니다

관련 문제