Android API 级别 < 11 中的 ObjectAnimator

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11628623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:16:56  来源:igfitidea点击:

ObjectAnimator in API Level < 11

androidandroid-compatibility

提问by StuStirling

So I'm getting really frustrated with android and the fact half the stuff doesn't work when you roll back the API Level past 11. Why isn't it easy and well done like iOS?!

所以我对 android 感到非常沮丧,事实上当你将 API 级别回滚到 11 以上时,有一半的东西不起作用。为什么不像 iOS 那样容易和做得好?!

The ProblemI am using ObjectAnimatorsto animate the transitioning between Fragments. They work fine in anything with API Level 11 and above. As soon as I change the build target to less than 11 I get problems with it saying it can't found the resource identifiers for attributes such as propertyNameand valueTypein the xml file.

问题我使用ObjectAnimators的动画之间的过渡Fragments。它们适用于 API 级别 11 及更高级别的任何内容。一旦我将构建目标更改为小于 11,我就会遇到问题,说它无法在 xml 文件中找到属性的资源标识符,例如propertyNamevalueType

The QuestionWhat should I use instead to animate my Fragmenttransitions that will work on API Levels > 7.

问题我应该使用什么来为我的Fragment过渡设置动画,这些过渡适用于 API 级别 > 7。

Thanks in advance.

提前致谢。

采纳答案by Rafael Nobre

I suggest using http://nineoldandroids.com/, its from the same maker of the ActionBarSherlock project, it introduces a support ObjectAnimator that works from API 1 onwards.

我建议使用http://nineoldandroids.com/,它来自 ActionBarSherlock 项目的同一制造商,它引入了一个从 API 1 开始工作的支持 ObjectAnimator。

回答by user370305

Property AnimationIntroduced in Android 3.0 (API level 11)

Property Animation在 Android 3.0(API 级别 11)中引入

For support lower android version, (I didn't try it, but you can use)

为了支持较低的android版本,(我没有尝试过,但你可以使用)

Nine Old AndroidsDownload

九个老安卓下载

Android library for using the Honeycomb (Android 3.0) animation API on all versions of the platform back to 1.0!.

用于在所有版本的平台上使用 Honeycomb (Android 3.0) 动画 API 的 Android 库回到 1.0!。

Also Look at this blog Fragment Transactions Reference

也看看这个博客Fragment Transactions Reference

and this SO question Android Fragment standard transition not animating

而这个SO问题Android Fragment标准过渡没有动画