android - Activity Transitions not working -
i trying implement activity transitions not able see effects. here code first activity:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_architecture); setupwindowanimations(); } private void setupwindowanimations() { if (android.os.build.version.sdk_int >= 21) { log.i("anim", "fade called"); fade fade = new fade(2); fade.setduration(3000); getwindow().setexittransition(fade); } }
here code second activity:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_image); setupwindowanimations(); } private void setupwindowanimations() { if (android.os.build.version.sdk_int >= 21) { log.i("anim", "slide called"); slide slide = new slide(gravity.left); slide.setduration(3000); getwindow().setentertransition(slide); } }
even though have set fade out animation, there no fading, also, slide works in default way, i.e. direction bottom instead of left.
here values/style.xml
, here v21/styles.xml
.
here androidmanifest.xml
:
<application android:name=".myapplication" android:allowbackup="true" android:hardwareaccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:largeheap="true" android:theme="@style/apptheme">
why these transitions not working , how make them work. used paste.ubuntu.com because editor not showing xml properly.
bundle bundle = activityoptions.makescenetransitionanimation(this).tobundle(); this.startactivity(intent,bundle);
add these 2 lines after setup intent between 2 activities work.
you cannot start activity via startactivity(intent)
method need specify transitions across activies using bundles.
Comments
Post a Comment