我尝试实现this animation library,但我仍然在SupportAnimator上遇到无法比拟的错误,并且不知道如何解决它。
这是代码(从库github粘贴的副本):
actionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
View myView = view.findViewById(R.id.awesome_card);
// get the center for the clipping circle
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;
// get the final radius for the clipping circle
int finalRadius = Math.max(myView.getWidth(), myView.getHeight());
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(myView,cx,cy,0,finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(1500);
animator.start();
}
});
进口:
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Button;
import io.codetail.animation.SupportAnimator;
有人可以帮忙吗?
答案 0 :(得分:2)
尝试将SupportAnimator更改为Animator。它应该工作
<强>更新强> 请确保您导入此库:
import io.codetail.animation.ViewAnimationUtils;