Android scene transition: Custom interpolator? -


i have activity launched scene transition shared element, , works properly.

activityoptionscompat options = activityoptionscompat.makescenetransitionanimation(getactivity(), sharedview, "sharedview"); intent intent = new intent(getactivity(), newactivity.class); activitycompat.startactivity(getactivity(), intent, options.tobundle()); 

the element animated smoothly old new activity. however, i'd change how transition animates bit, particularly interpolator. seems using default smooth interpolator, i'd use new material fast-out-slow-in interpolator, , can't figure out how specify that.

what should override default transition?

in case haven't figured out yet:

create new transitionset in /res/transition/, define transition tags properties , interpolators, apply activity style in /res/values-v21/styles.xml

example newactivity

  • create new_activity_transition.xml inside /res/transition/ contains following example transition tags , interpolators:

    <transitionset xmlns:android="http://schemas.android.com/apk/res/android">     <changeimagetransform         android:interpolator="@android:interpolator/fast_out_slow_in"        />     <arcmotion         android:interpolator="@android:interpolator/fast_out_slow_in"/>     <changebounds         android:duration="300"         android:interpolator="@android:interpolator/fast_out_slow_in"/> </transitionset> 
  • then set shared element enter transition in /res/values-v21/styles.xml:

    <style name="newactivity">     <item name="android:windowsharedelemententertransition">@transition/new_activity_transition</item> </style> 
  • don't forget set activity theme in androidmanifest.xml:

    <activity       android:name="{path to}.newactivity"       android:theme="@style/newactivity"> </activity> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -