2

2 つのフラグメント間で SharedElement Transition を使用しています。.replace() では問題なく動作しますが、.add() を使用するとトランジションが機能しません。何か不足していますか?

新しいフラグを開始する onItemClickListener。

urlSetter(list.get(position).getId());
TextView image = (TextView) itemView.findViewById(R.id.teamID);

newFragment = new TeamsActivity();
Bundle args = new Bundle();

FragmentTransaction transaction = getFragmentManager().beginTransaction();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    args.putString("TRNS", image.getTransitionName());
    newFragment.setSharedElementEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.trans_move));
    newFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.explode));
    setSharedElementReturnTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.slide_top));
    setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.no_transition));
    transaction.addSharedElement(image, image.getTransitionName());
}
args.putInt("LOGO", mTeamLogos[list.get(position).getId()].getDrawableId());
args.putString("CLUB", list.get(position).getName2());
args.putString("URL", url);
args.putInt("POSITION", position);
newFragment.setArguments(args);

transaction.addToBackStack("xyz");
transaction.add(R.id.frame_layout, newFragment);
transaction.commit();
4

0 に答える 0