-1

My current android application has a requirement to have the "Next" screen slide up from the bottom of the screen as the current view slides out from the top. I can achieve this effect with anim and overridePendingTransition. However i want the "Next" screen to slide up faster from the bottom than than the current screen is sliding out the top of the screen. What attributes (and values) do i require in my animation xml files to achieve this effect?

Hector
  • 4,016
  • 21
  • 112
  • 211

2 Answers2

1

This will slide the next screen in from the bottom to the top and the current screen out from the top and 25% up making the next screen slide over the current screen.

slide_in_bottom.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_mediumAnimTime"
    android:fromYDelta="100%p"
    android:toYDelta="0" />

slide_out_top.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_mediumAnimTime"
    android:fromYDelta="0"
    android:toYDelta="-25%p" />
mariusgreve
  • 2,621
  • 6
  • 23
  • 31
0
slide_in_left.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="100%p" android:toXDelta="0%p"
    android:duration="@android:integer/config_shortAnimTime"/>

slide_out_left.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0" android:toXDelta="-100%p"
    android:duration="@android:integer/config_shortAnimTime" />


overridePendingTransition(R.anim.slide_in_left,
                        R.anim.slide_out_left);
Dakshesh Khatri
  • 639
  • 7
  • 12
  • Thanks for taking the time to look at my question, however This pair of anim.xmls do not give me the effect i require. They give the effect of one screen pushing the other out of the way. I want the current screen to "slowly" slide off the top of the screen while the second screen slides in from the bottom "Quickly" – Hector Jan 23 '14 at 14:08