android - Activity and Fragment Transitions in Lollipop -


i'm trying wrap head around new activity transition framework in lollipop. activity transition works pretty straighforward , there basic info here, fragment transition undocumented , can't work. i've tried use case (very common in android):

case 1: acta+fraga -> actb+fragb

with sharedelement being image in fraga , fragb. didn't come working code, went step , tried

case 2: acta+fraga -> actb

with sharedelement on fraga , actb. animation won't work, can see when click image on fraga, image disappear , after animation's duration pops in actb. shared views outside fraga inside acta (the toolbar example) animate correctly.

in case sharedimage imageview in recyclerview, xml tag android:transitionname="shared_icon" in item's layout xml doesn't work?

this theme:

 <!-- window transactions -->     <item name="android:windowcontenttransitions">true</item>     <item name="android:windowallowentertransitionoverlap">true</item>     <item name="android:windowallowreturntransitionoverlap">true</item>     <item name="android:fragmentallowentertransitionoverlap">@bool/true_bool</item>     <item name="android:fragmentallowreturntransitionoverlap">@bool/true_bool</item>      <item name="android:windowentertransition">@transition/window_transition.xml</item>     <item name="android:windowexittransition">@transition/window_transition.xml</item>     <item name="android:fragmententertransition">@transition/window_transition.xml</item>     <item name="android:fragmentreturntransition">@transition/window_transition.xml</item>     <item name="android:fragmentreentertransition">@transition/window_transition.xml</item>      <!-- shared element transactions -->     <item name="android:windowsharedelemententertransition">@transition/shared_elements_transform.xml</item>     <item name="android:windowsharedelementexittransition">@transition/shared_elements_transform.xml</item>      <item name="android:fragmentsharedelemententertransition">@transition/shared_elements_transform.xml</item>     <item name="android:fragmentsharedelementreturntransition">@transition/shared_elements_transform.xml</item> 

window_transition.xml:

<?xml version="1.0" encoding="utf-8"?> <transitionset xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="together" android:duration="@integer/act_transition_duration"> <changebounds  /> <changetransform /> <changeclipbounds /> <changeimagetransform /> </transitionset> 

shared_element_transition.xml:

<?xml version="1.0" encoding="utf-8"?> <transitionset xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="together" android:duration="@integer/act_transition_duration"> <changeimagetransform /> <changebounds /> </transitionset> 

fragment transitions meant work between fragments in same activity. if have 2 different activities, whether have fragments or not, using activity transitions. feel free ignore fragment transition properties.

in case 2, should have no problems transitions if set properly. i'm guessing application theme not derive android:theme.material, need 1 more property:

<item name="android:windowactivitytransitions">true</item> 

windowcontenttransitions allows use transitionmanager smoothly animate between setcontentview of window.

when have fragment in launched activity, case 1, may need @alexlockwood suggested: postponeentertransition. however, should able use:

getfragmentmanager().executependingtransactions(); 

inside oncreate() force fragment load right away activity transition see views in layout.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -