android中屬性動畫的bug,以及ViewCompat

ViewCompat這個類,是andorid對於動畫類操作的兼容類,今天寫了一個側拉框,出現的一個bug

   今天一不小心遇見一個bug,這個bug如下

正常 情況下慢慢畫動畫可以用,但是快速化,動畫就停止了,


今天先貼代碼,明天貼圖

  final CycleInterpolator cycleInterpolator = new CycleInterpolator(7);
        ViewCompat.animate(head_iv).translationX(30).setDuration(1000).setInterpolator(cycleInterpolator)
                .setListener(new ViewPropertyAnimatorListener() {
                    @Override
                    public void onAnimationStart(View view) {

                    }

                    @Override
                    public void onAnimationEnd(View view) {
                        Log.d("haha", "ceshi c,,");
                        head_iv.clearAnimation();
                    }

                    @Override
                    public void onAnimationCancel(View view) {

                    }
                });//設置動畫,跟次數

放棄這個,換不兼容的包,解決了bug

 ObjectAnimator valueAnimator= ObjectAnimator.ofFloat(head_iv,"TranslationX",0,30);
//        valueAnimator.setInterpolator(cycleInterpolator);
//        valueAnimator.start();


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章