ActivityOptions.makeSceneTransitionAnimation似乎并不存在 [英] ActivityOptions.makeSceneTransitionAnimation doesn't seem to exist

查看:1077
本文介绍了ActivityOptions.makeSceneTransitionAnimation似乎并不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的大号推出了全新的动画功能:在不同的活动相似的看法之间的动画。它的记录这里

我试图使用 ActivityOptions.makeSceneTransitionAnimation ,但它似乎并没有在SDK中可见(或罐子的话),所以我试图使用反射,并返回空值。

有没有其他人得到它的工作?

解决方案

好吧,我得到它的工作。

这似乎是设置在styles.xml的价值是完全忽略了。

您需要做的每一项活动的onCreate到那的固定式

  getWindow()requestFeature(Window.FEATURE_CONTENT_TRANSITIONS)。
过渡过渡= //负载变化在这里。
。getWindow()setSharedElementEnterTransition(过渡);
。getWindow()setSharedElementExitTransition(过渡);
 

按照同样的错误ViewAnimationUtils了,你会看到Android的Studio中的错误,它会编译并运行良好,但。

Android L introduced a new animations feature: animating between similar Views in different activities. It's documented here.

I've tried to use ActivityOptions.makeSceneTransitionAnimation, but it doesn't seem to be visible in the SDK (or in the jar at all), so I tried using reflection, and it returns a null value.

Has anyone else got it working?

解决方案

Okay, I got it working.

It seems like setting the value in styles.xml is completely ignored for now.

You'll need to do this in each Activity's onCreate till that's fixed

getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
Transition transition = // load transition here.
getWindow().setSharedElementEnterTransition(transition);
getWindow().setSharedElementExitTransition(transition);

As per the same bug ViewAnimationUtils has, you'll see errors in Android Studio, it'll compile and run fine though.

这篇关于ActivityOptions.makeSceneTransitionAnimation似乎并不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆