Reputation: 1903
I want to replace Fragment
using FragmentTransaction
.
It works fine but during remplacement, Android displays a blank screen very ugly before displaying the new Fragment
Code is :
FragmentManager mng = getSupportFragmentManager();
FragmentTransaction transac = mng.beginTransaction();
transac.replace(R.id.contentframe, myFragment, CUSTOM_TAG); // replace current fragment by myFragment
transac.commit();
After commit()
call, old fragment disappeared, a blank screen is displayed few milliseconds then new fragment is displayed.
Is anyone know how could I avoid this blank screen to be displayed during the transaction ?
Thanks.
Upvotes: 0
Views: 2423
Reputation: 2483
You can set custom animations during Transaction.
fragmentTransaction.setCustomAnimations(R.anim.card_flip_right_in,R.anim.card_flip_right_out,R.anim.card_flip_left_in,R.anim.card_flip_left_out);
Like this. You can define animations.
Hope it helps
Upvotes: 5