K
K
kinton2018-03-09 00:42:55
Java
kinton, 2018-03-09 00:42:55

Why does the fragment change animation slow down?

Hello!
I use the following code to animate the change of fragments:

fTrans = getFragmentManager().beginTransaction();
                //fTrans.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                //fTrans.setCustomAnimations(R.animator.prev_fragm, R.animator.new_fragm);
                fTrans.replace(R.id.frgmCont, signInFrag);
                fTrans.addToBackStack(null);
                fTrans.commit();

However, the setTransition and setCustomAnimations methods are terribly slow when I start the application. Why is this happening, perhaps there are ways to deal with it?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Yudakov, 2018-03-09
@AlexanderYudakov

setTransition() and setCustomAnimations() are two different ways to start an animation.
At a minimum, they should not be used together.
Read more here: daniel-codes.blogspot.ru/2012/06/fragment-transact...
I had a case where standard animations (TRANSIT_FRAGMENT_OPEN) slowed down on an ancient device (API 9, Android 2.3). I had to add an OS version check to the code and disable animations (up to version 15 of the API).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question