-1
我正在嘗試使用對象動畫製作動畫顏色,但它不會改變顏色。她是代碼示例對象動畫不起作用
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
colorAnimator=ObjectAnimator.ofArgb(button.getBackground().mutate(),"tint",
getResources().getColor(R.color.colorAccent),getResources().getColor(R.color.colorPrimaryDark));
colorAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
colorAnimator.start();
}else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
colorAnimator=ObjectAnimator.ofObject(button.getBackground().mutate(),"tint",new ArgbEvaluator(),
getResources().getColor(R.color.colorAccent),getResources().getColor(R.color.colorPrimaryDark));
colorAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
colorAnimator.start();
}
我還沒有添加對象動畫器對象到按鈕?