使用共享元素在具有不同方向的活动之间转换

时间:2015-05-16 10:02:09

标签: android android-animation android-5.0-lollipop shared-element-transition activity-transition

我有一个活动A,它以横向方向永久设置,活动B没有任何预定义的方向。

如果我从活动A开始活动B并且手机旋转处于横向角度,则共享元素转换正常工作,活动B按预期以横向方向启动。如果在活动B开始期间电话旋转处于纵向角度,则会出现问题。然后,活动B以纵向方向(按预期方式)启动,但不会发生转换。

之前有没有人遇到过这个问题?任何帮助,将不胜感激。 这就是从活动A调用活动B的方式:

Intent mIntent = new Intent(context, ActivityB.class); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, sharedView,sharedViewTransitionName); startActivity(mIntent,options.toBundle());

1 个答案:

答案 0 :(得分:0)

您可以查看此库以获取棒棒糖前设备的活动和片段转换。这支持场景转换

   dependencies {
    compile 'com.albinmathew:PreLollipopTransition:1.1.2'

}

https://github.com/albinmathew/PreLollipopTransition