1
如何在Android中反轉AnimationDrawable。Android中AnimationDrawable結尾的逆向動畫
爲了優化我的應用程序,我想在我的動畫到達結尾時反轉動畫。
這裏是我的代碼:
AnimationDrawable animation = new AnimationDrawable();
animation.addFrame(getResources().getDrawable(R.drawable.ball1), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball2), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball3), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball4), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball5), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball6), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball5), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball4), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball3), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball2), 100);
animation.addFrame(getResources().getDrawable(R.drawable.ball1), 100);
animation.setOneShot(false);
ImageView imageAnim = (ImageView) findViewById(R.id.image_view1);
imageAnim.setBackgroundDrawable(animation);
animation.start();
我希望動畫改變方向,而不是裝載了5倍新的圖像,但我不找到如何做到這一點。
感謝
蒂博
如果你覺得有用接受答案 – Don
不能使用方法 「setInterpolator()」 上AnimationDrawable –