下面列出了android.view.Window#setReenterTransition ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@TargetApi(21) private void initTransitions() {
Window window = getActivity().getWindow();
window.setEnterTransition(
new ExplodeFadeEnterTransition(senderNameView, senderMailView, separatorLine));
window.setExitTransition(new ExcludedExplodeTransition());
window.setReenterTransition(new ExcludedExplodeTransition());
window.setReturnTransition(new ExcludedExplodeTransition());
TransitionSet textSizeSet = new TransitionSet();
textSizeSet.addTransition(
TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.move));
TextSizeTransition textSizeTransition = new TextSizeTransition();
textSizeTransition.addTarget(R.id.subject);
textSizeTransition.addTarget(getString(R.string.shared_mail_subject));
textSizeSet.addTransition(textSizeTransition);
textSizeSet.setOrdering(TransitionSet.ORDERING_TOGETHER);
window.setSharedElementEnterTransition(textSizeSet);
getActivity().setEnterSharedElementCallback(
new TextSizeEnterSharedElementCallback(getActivity()));
}
private void initTransition() {
Window window = getWindow();
TransitionSet set = new TransitionSet();
AutoTransition autoTransition = new AutoTransition();
autoTransition.excludeTarget(R.id.ic_head, true);
autoTransition.addTarget(R.id.tx_name);
autoTransition.addTarget(R.id.ic_location);
autoTransition.addTarget(R.id.tx_location);
autoTransition.setDuration(600);
autoTransition.setInterpolator(new DecelerateInterpolator());
set.addTransition(autoTransition);
BezierTransition bezierTransition = new BezierTransition();
bezierTransition.addTarget(R.id.ic_head);
bezierTransition.excludeTarget(R.id.tx_name, true);
bezierTransition.excludeTarget(R.id.ic_location, true);
bezierTransition.excludeTarget(R.id.tx_location, true);
bezierTransition.setDuration(600);
bezierTransition.setInterpolator(new DecelerateInterpolator());
set.addTransition(bezierTransition);
CircularRevealTransition transition = new CircularRevealTransition();
transition.excludeTarget(android.R.id.statusBarBackground, true);
window.setEnterTransition(transition);
window.setReenterTransition(transition);
window.setReturnTransition(transition);
window.setExitTransition(transition);
window.setSharedElementEnterTransition(set);
window.setSharedElementReturnTransition(set);
}
private void initPushInAnim() {
Window window = getWindow();
window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
TransitionInflater inflater = TransitionInflater.from(mContext);
Transition pushDownIn = inflater.inflateTransition(R.transition.explode_in);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setEnterTransition(pushDownIn); // 第一次进入时使用
window.setReenterTransition(pushDownIn); // 再次进入时使用
window.setExitTransition(pushDownIn);
}
}