Android Animation 幀動畫監聽結束的方法
阿新 • • 發佈:2019-01-31
- public void mmswoon(){
- imageView.setBackgroundResource(R.anim.mmswoon);
- AnimationDrawable animationDrawable = (AnimationDrawable)imageView.getBackground();
- animationDrawable.start();
- int duration = 0;
- for(int i=0;i<animationDrawable.getNumberOfFrames();i++){
- duration += animationDrawable.getDuration(i);
- }
- Handler handler = new Handler();
- handler.postDelayed(new Runnable() {
- public void run() {
- //此處呼叫第二個動畫播放方法
- }
- }, duration);
- }