1

请帮助解决这个问题。

我有一个自定义类 CardList

public class CardList extends AdapterView<ArrayAdapter>

有一个使用此自定义视图的 Player 类。

CardList 有 Touch,Drag 事件监听器。TouchListner 也确定 View Click。单击 View 时,它对 Player 类中的侦听器函数进行回调。玩家类调用下面的函数来为 CardClick 设置动画。但是动画不起作用。

令人惊讶的是,如果直接从 View 的 Touch 事件侦听器调用该函数,动画就会起作用。

//Animate Function inside Custom View

public void animateTopCardClick(Animation animation) {
        ValueAnimator animator = ObjectAnimator.ofPropertyValuesHolder( this.getChildAt( getChildCount() - 1 ),
                PropertyValuesHolder.ofFloat( "alpha", 1.0f, 0 ),
                PropertyValuesHolder.ofFloat( "rotationY", -180.0f, 0 ),
                PropertyValuesHolder.ofFloat( "alpha", 0.0f, 1.0f )
        ).setDuration( 1000 );

        animator.setInterpolator( new AccelerateInterpolator() );
        animator.start();
    }

任何想法为什么从播放器类调用动画时不起作用?该问题的任何解决方法。?

4

0 回答 0