5

我一直在尝试使用 android 网站上显示的示例示例在多个共享元素上实现动画转换

    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this,
    Pair.create(view1, "agreedName1"),
    Pair.create(view2, "agreedName2"));

但是当我尝试在 Eclipse IDE 中的示例应用程序上实现此代码时,它说

The method makeSceneTransitionAnimation(Activity, View, String) in the type ActivityOptions is not applicable for the arguments (MyActivity, Pair<View,String>, Pair<View,String>)

我可以在那里使用一些帮助。谢谢。

4

2 回答 2

1

我刚刚遇到了同样的问题。就我而言,我已经导入

import android.support.v4.util.Pair;

代替

import android.util.Pair;
于 2015-12-19T10:17:55.977 回答
0

在我的案例中,我试图通过imageViewand linearLayout,而方法是期待Views.

所以我做到了,View view1 = imageView; 并且View view2 = linearLayout。并将它们传递给方法。

于 2016-10-31T08:30:44.730 回答