2013-12-07 4 views
1

Привет, здесь я попытался начать работу после завершения Drawable animaition, но я не могу этого сделать, поэтому здесь я показываю вам код, который я дал, помогите мне найти из раствораПереход к новому действию при завершении анимации с анимацией

package com.example.hole; 
    import android.os.Bundle; 
    import android.app.Activity; 
    import android.content.Intent; 
    import android.graphics.drawable.AnimationDrawable; 
    import android.widget.ImageView; 


    public class MainActivity extends Activity { 

      ImageView view; 
     AnimationDrawable frameAnimation; 
     @Override 
     protected void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.activity_main); 
      // Typecasting the Image View 
        view = (ImageView) findViewById(R.id.imageAnimation); 
        // Setting animation_list.xml as the background of the image view 
        view.setBackgroundResource(R.drawable.ass); 
        // Typecasting the Animation Drawable 
        frameAnimation = (AnimationDrawable) view.getBackground(); 
     } 
     // Called when Activity becomes visible or invisible to the user 
     @Override 
     public void onWindowFocusChanged(boolean hasFocus) { 
      super.onWindowFocusChanged(hasFocus); 
       if (hasFocus) 
       { 
      // Starting the animation when in Focus 
        frameAnimation.start(); 
      } 
      else 
       { 
       // Stoping the animation when not in Focus 
       frameAnimation.stop(); 

       } 
       } 
    } 

ответ

0

Вы можете установить AnimationListener к анимации с помощью вызова метода frameAnimation.setAnimationListener() в вашем OnCreate метод.

Смежные вопросы