android - Fragment exit transition doesn't play between two instances of the same Fragment -


i built primitive app consisting of 1 activity , 2 fragments. fragment1 can either navigate instance of fragment1 or fragment2. when navigating between 2 fragments, i'm setting enter , exit transition.

for reason, exit transition plays when i'm navigating fragment1 fragment2, never between 2 instances of fragment1. here's relevant code fragment1:

@override public void onviewcreated(view view, bundle savedinstancestate) {      view.findviewbyid(r.id.buttonsame).setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             nextfragment(new fragment1());         }     });      view.findviewbyid(r.id.buttondifferent).setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             nextfragment(new fragment2());         }     });  }  private void nextfragment(fragment frag) {     setexittransition(             transitioninflater.from(getactivity()).inflatetransition(r.transition.enter_exit));      frag.setentertransition(             transitioninflater.from(getactivity()).inflatetransition(r.transition.enter_exit));      getactivity().getsupportfragmentmanager().begintransaction()              .replace(r.id.layoutcontent1, frag)              .addtobackstack(null)              .commit(); } 

here's demonstration of behavior:

enter image description here

is there way make exit transition play when going between 2 instances of same fragment?

edit:

it seems problem both fragments use views same id framework assumes should part of shared element transition. problem disappears when copy layout , modify ids. however, i'm still looking solution doesn't involve copying layouts.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -