3
I’m working on an app that consists of several fragments
and decided to put animations between them. Looking, I found that I should use the command setCustomAnimations
to get the desired result, but I can only get two possible animations: fade-in and fade-out.
Searching the platform folders I’m using (android-19
, or Android 4.4.2) saw that there are other animations that are not available on my SDK are present in the folder (fragment_close_enter/exit
, fragment_fade_enter/exit
, fragment_open_enter/exit
).
Why isn’t my SDK recognizing them? This is the code I’m using to create the fragment
:
FragmentTransaction transFrag = getFragmentManager().beginTransaction();
Fragment login = new LoginFragment();
transFrag.setCustomAnimations(android.R.animator.fade_in,
android.R.animator.fade_out);
transFrag.addToBackStack(null);
transFrag.replace(R.id.container_login, login);
transFrag.commit();
I was thinking about it, but I don’t know exactly how to "convert" from
anim
foranimator
, because I realized there’s a difference in syntax. Is there anywhere I can read more about this?– Renan Lazarotto
Yes, objectAnimator works from API 11. I don’t know where you can read to "convert" from the old framework to the new one or vice versa. If not find, I advise to study both and understand what does what in each of them.
– Rafaela Stulbach
I got it. I managed to insert the animations I wanted just by correcting a few mistakes, so I don’t think I’ll need to convert the others. Thank you!
– Renan Lazarotto