I am trying to animate 2 Fragments [Splash Fragment , Fragment 1]
While the transition there is a white blank screen for small milli Secs which should not be there
The code of Animation Resource File : -
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="100%" android:toXDelta= "0%" android:duration = "250"/>
</set>
This file I was adding in Navigation file for a action in the field of enter Anim
The navigation from my splash Fragment is as follows:
Handler().postDelayed({findNavController().navigate(R.id.action_splashScreen_to_onBording)},3000)
As mentioned the basic problem is while the Transition there is a small window of few milli secs where a white screen is appearing and spoiling the view . How do I remove it?
Thanks in advance
CodePudding user response:
As I can not make sense out of you animation file which is fromYDelta, toXDelta, which are to opposite things. So, I am considering you have meant fromYDelta toYDelta, which will make the fragment slide from bottom to top.
Now, about the answer. When setting up animations on navigation you have to create an exit animation as well as enter animation. Otherwise you'll face this problem of white screen.
So, what you can do is add the below animation as exit animation.
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%" android:toYDelta= "-100%" android:duration = "450"/>
</set>
It will make the splash fragment slide upwards as well, but slower than the fragment1. And empty white screen will not be shown.