java - How to launch an android app(not an activity) from the bottom of the screen to top? -
i have used overridependingtransition()
already used open activity given transition not app.
moreover works when having intent on clicking on button, won't work if use overridependingtransition()
in oncreate()
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main2); intent = new intent(main2activity.this,mainactivity.class); startactivity(i); overridependingtransition(r.anim.slide_in_up,r.anim.slide_out_up); }
before setcontentview use following code :
overridependingtransition(r.anim.slide_in_from_bottom, r.anim.fade_out);
and in finish() use following code :
@override public void finish() { super.finish(); overridependingtransition(r.anim.fade_in, r.anim.slide_out_back_to_bottom); }
and create anim folder , put these files :
slide_in_from_bottom:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:zadjustment="top"> <translate android:duration="400" android:fromydelta="100%p" android:toydelta="0%p" > </translate> <alpha android:fromalpha="0.8" android:toalpha="1.0" android:duration="400" /> </set>
slide_out_back_to_bottom:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:zadjustment="top"> <translate android:duration="400" android:fromydelta="0%p" android:toydelta="100%p" > </translate> <alpha android:fromalpha="1.0" android:toalpha="0.8" android:duration="400" /> </set>
fade_in:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:zadjustment="bottom"> <alpha android:fromalpha="0.0" android:toalpha="1.0" android:duration="300" /> </set>
fade_out:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:zadjustment="bottom"> <alpha android:fromalpha="1.0" android:toalpha="0.0" android:duration="200" /> </set>
complete implementation can found here.
Comments
Post a Comment