2

アニメーションと画像リソースの設定で問題が発生しています。

TranslateAnimationが終了した後にImageViewの画像を変更したいのですが、これを行うと、アニメーションが機能しなくなります...

これが私のコードです:

TranslateAnimation anim = new TranslateAnimation(0, infoBoxLeft - infoBoxOffset, 0, 0);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(millis);

    anim.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation animation) {

            arrowImage.setImageResource(R.drawable.arrow_left);

            infoBox.layout(infoBoxLeft - infoBoxOffset, infoBox.getTop(), (infoBoxLeft - infoBoxOffset)
                    + infoBoxWidth, infoBox.getTop() + infoBox.getHeight());

            infoBox.clearAnimation();

        }
    });

    infoBox.startAnimation(anim);

行を削除すると、arrowImage.setImageResource(R.drawable.arrow_left);すべてが正常に機能し、アニメーションが実行されません。setImageDrawable代わりに(ドキュメントにはUIスレッドで実行されていないと記載されているため)すでに使用してみましたが、違いはありません。setImageResourceまた、コールバックの前/後にコールバックを呼び出そうとしましたstartAnimation

何か案は?

前もって感謝します。

4

0 に答える 0