I currently have one Activity which contains a Fragment
by injecting it inside a LinearLayout
during runtime.
Inside my Activity
layout, I have a Button
view called nextButton
. When I click this button, I want the Activity
to switch to the next Fragment
but ALSO animate where the current fragment moves off the screen to the left and the new fragment comes in from the right. As if the new fragment is pushing the current fragment out of the way.
Below is a demonstration of what I want.
Shall I store all of the Fragments in an ArrayList<Fragment>
and just inject the current index + 1 in to the LinearLayout
when the nextButton
is clicked? What would be the best way to go about this?