Transition android fragment slide up
android, android-fragments, android-layout, animation
Solution
transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.slide_out_up);
transaction.addToBackStack(null);
transaction.replace(R.id.my_fragment, newFrag);
slide_in_up
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="100%p"
android:toYDelta="0%p" />
slide_out_up
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="0%p"
android:toYDelta="-100%p" />
Problem
I have a fragment that is to replace another fragment. I want to specify the animation. But the animation is ignored. ``` transaction.replace(R.id.my_fragment, newFrag); transaction.addToBackStack(null); transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.slide_out_up); ``` slide_in_up ``` <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="@android:integer/config_longAnimTime" android:fromYDelta="0%p" android:toYDelta="100%p" /> ``` slide_out_up ``` <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="@android:integer/config_longAnimTime" android:fromYDelta="100%p" android:toYDelta="0%p" /> ``` All I am really trying to achieve is for the new fragment to slide in from the bottom. My animations are ignored. What is the code missing?