I want to start my activity from bottom to top just like the sliding effect, and i searched and even used all the possible codes but its not working so can anyone please help me out for this. I even used below code:
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
I have also using following xmls also:
slide-in-up.xml
<translate
android:duration="5000"
android:fromYDelta="100%p"
android:toYDelta="0" />
<alpha
android:duration="5000"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
slide-out-up.xml
<translate
android:duration="5000"
android:fromYDelta="0"
android:toYDelta="-100%p" />
<alpha
android:duration="5000"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
but then too its not working.
You can try something like
Animation animMove;
animMove = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.move);
animMove.setAnimationListener(this);
where your move.xml is
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromYDelta="50%p"
android:toYDelta="0%p"
android:duration="800" />
</set>
Here you have to change fromYDelta parameter as per your requirenment.
Define an animation in res/anim/slide_in_up.xml:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="100%p" android:toYDelta="0%p"
android:duration="@android:integer/config_longAnimTime"/>
and another at res/anim/slide_out_up.xml:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="0%p" android:toYDelta="-100%p"
android:duration="@android:integer/config_longAnimTime"/>
Then apply these after to call startActivity:
Intent i2 = new Intent(main.this, test.class);
startActivity(i2);
overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
Check my answer below if you are looking for Top-Bottom and Bottom-Top animations :
You can change the value of fromDelta and toDelta if you want from left-right and right-left animations.
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.