我有一个动画,我希望在新活动加载的同时运行。它是一个圆形扩展动画,围绕下一个活动的扩展。在圈动画运行的那一刻,然后活动加载。我想同时做两件事。
这是我目前的代码:
Intent intent = new Intent(getActivity(), RequestHolidayActivity.class);
intent.putExtra(Keys.HOLIDAY, "whatever");
startActivity(intent);
revealYellow(event.getRawX(), event.getRawY());
getActivity().overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
这是动画代码:
private void revealYellow(float x, float y) {
animateRevealColorFromCoordinates(animateView, R.color.Banksy, (int) x, (int) y);
}
private Animator animateRevealColorFromCoordinates(ViewGroup viewRoot, @ColorRes int color, int x, int y) {
float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());
Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
viewRoot.setBackgroundColor(ContextCompat.getColor(getContext(), color));
anim.setDuration(500);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.start();
return anim;
}
如何让动画和startActivity同时运行?