Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swap fragment in an activity via animation
- FragmentManager fragmentManager = getSupportFragmentManager();
- FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
- fragmentTransaction.replace(R.id.container, new FragB());
- fragmentTransaction.commit();
- FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right);
- ft.replace(R.id.fragment_container, newFragment, "fragment");
- // Start the animated transition.
- ft.commit();
- <?xml version="1.0" encoding="utf-8"?>
- <set>
- <translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromXDelta="-100%"
- android:toXDelta="0"
- android:interpolator="@android:anim/decelerate_interpolator"
- android:duration="500"/>
- </set>
- <?xml version="1.0" encoding="utf-8"?>
- <set>
- <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
- android:propertyName="x"
- android:valueType="floatType"
- android:valueFrom="-1280"
- android:valueTo="0"
- android:duration="500"/>
- </set>
Advertisement
Add Comment
Please, Sign In to add comment