Android Object Animator throw无法解析类型

时间:2016-02-08 19:47:13

标签: android

我正在尝试使用以下代码在Android中创建一个Object Animator:

ObjectAnimator animation = new ObjectAnimator.ofInt(...);

虽然编译器不断在“ofInt”下抛出错误说:

  

无法解析符号'ofInt'

我做错了什么让我发疯。

2 个答案:

答案 0 :(得分:3)

new ObjectAnimator().ofInt(..)

我认为你忘了()*构造函数/方法调用

答案 1 :(得分:1)

致电ObjectAnimator animation = new ObjectAnimator.ofInt(...); 是错误的,你需要正确调用构造函数,然后调用你需要的方法......

ObjectAnimator animation = new ObjectAnimator();
animation.ofInt(...);