谷歌刚刚发布了 android.support.transition 包,提供转换框架的后备,这真是太棒了。
https://developer.android.com/reference/android/support/transition/package-summary.html
不幸的是,当尝试将此包中的 Transition/TransitionSet 对象作为片段事务的共享元素使用时,应用程序会因以下错误而失败:
有没有办法将新的后移转换用作共享元素转换?
https://developer.android.com/reference/android/support/transition/package-summary.html
不幸的是,当尝试将此包中的 Transition/TransitionSet 对象作为片段事务的共享元素使用时,应用程序会因以下错误而失败:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: gregor.martin.loginregisteractivity, PID: 26186
java.lang.ClassCastException: android.support.transition.TransitionSet cannot be cast to android.transition.Transition
at android.support.v4.app.FragmentTransitionCompat21.wrapSharedElementTransition(FragmentTransitionCompat21.java:86)
at android.support.v4.app.BackStackRecord.getSharedElementTransition(BackStackRecord.java:1156)
at android.support.v4.app.BackStackRecord.configureTransitions(BackStackRecord.java:1222)
at android.support.v4.app.BackStackRecord.beginTransition(BackStackRecord.java:1112)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:721)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1677)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:536)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
有没有办法将新的后移转换用作共享元素转换?
transition
回退的API仅适用于视图级别。您无法将它们用于Activity转换(因为这是通过Activity的窗口完成的,该窗口具有API 21+的转换方法),也无法用于Fragment转换。”让我们开始... - Gergely Kőrössy