我正在研究一个小项目,一个图像板应用程序,并且我正在尝试实现它100%的材质设计。将动画连接到视图转换
https://www.youtube.com/watch?v=Tr6U3hclx8I
我想补充一个小衰落动画,每个项目有重叠。正如你可以看到当我点击某个项目时,顶部和底部的叠加层正在执行淡出动画。事情是,当它回来时,动画看起来有点笨重。我希望来自细节的图像缩小,然后回到原来的位置,然后顶部和底部的叠加层将带有淡入淡出的动画。
问题在于,我无法找到适当的钩子来执行此操作。我的意思是,我怎么能知道转换动画何时结束,然后在动画中执行淡入淡出?
下面的代码一点点:
public void onItemClicked(final Vox vox, final VoxItemView view) {
//I'm using an AnimatorInflator to inflates these animations in the fragment's onCreate method
mFadeOutBottom.setTarget(view.getBottomOverlayView());
mFadeOutTop.setTarget(view.getTopOverlayView());
mFadeInBottom.setTarget(view.getBottomOverlayView());
mFadeInTop.setTarget(view.getTopOverlayView());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(mFadeOutBottom, mFadeOutTop);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
//When the animation ends then I jump to the detail screen
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
view.getImageView(),
ViewCompat.getTransitionName(view.getImageView()));
startActivity(VoxDetailActivity.getStartIntent(getActivity(), vox), options.toBundle());
//I tried setting the fade in animation here, but it doesnt work
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(mFadeInBottom, mFadeInTop);
animatorSet.start();
}
});
animatorSet.start();
}
的VoxItemViews是在RecyclerView格的意见。
如果有人能指出我在正确的方向,我会很感激。