我正在使用来自 Shared Element lib 的 makeSceneTransitionAnimation API 调用将折叠工具栏标题中的图像共享到详细视图活动。忽略 FAB 看起来不合适的地方,如果我能让它看起来更好,我计划将它们滑出动画的一部分。
看起来很可怕:https ://youtu.be/Js91TAvwrV0
继承人的代码:
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void LollipopTransition(View v) throws IOException {
Log.d("The Jones Theory", "LollipopTransition...");
ImageView imgFavorite = (ImageView) findViewById(R.id.header);
final View nestedContent = findViewById(R.id.nested_content);
hideView(nestedContent);
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(PostSelectedActivity.this, imgFavorite, "photo_hero").toBundle());
}
getWindow().getEnterTransition().addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
getWindow().getEnterTransition().removeListener(this);
// load the full version, crossfading from the thumbnail image
Ion.with(photoView)
.crossfade(true)
.deepZoom()
.load(PostImage);
}