我試圖爲片段之間的轉換設置動畫。在片段之間的共享元素轉換期間拆分視圖
但在過渡觀點開始分離
請告訴我如何避免這種情況?在運動開始時,第一個視圖必須消失。 謝謝!
@Override
public void onClickMessage(DialogItem item, View view) {
setSharedElementReturnTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.change_image_transform));
setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.fade));
DetailsFragment fragment = new DetailsFragment();
fragment.setDialog(item);
fragment.setSharedElementEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.change_image_transform));
fragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.fade));
View ava = view.findViewById(R.id.ivPhoto);
ava.setTransitionName(DetailsFragment.AVA_TRANS);
View name = view.findViewById(R.id.tvName);
name.setTransitionName(DetailsFragment.NAME_TRANS);
FragmentTransaction ft = getFragmentManager().beginTransaction()
.replace(R.id.container, fragment)
.addToBackStack(null)
.addSharedElement(ava, DetailsFragment.AVA_TRANS)
.addSharedElement(name, DetailsFragment.NAME_TRANS);
ft.commit();
}
添加多個鏈接[視頻樣本(https://github.com/krawa/SharedElementFragmentTransition/blob/master/images/device-2015-06-26-165848.mp4)和 [來源代碼(HTTPS: //github.com/krawa/SharedElementFragmentTransition) – krawa
你能解決這個問題嗎? – tabjsina