【问题标题】:PropertyValuesHolder: Couldn't find setter/getter for property <property-name> with value type floatPropertyValuesHolder:找不到值类型为 float 的属性 <property-name> 的 setter/getter
【发布时间】:2013-07-07 23:44:30
【问题描述】:

我在使用PropertyValuesHolder.ofFloat(....)时遇到以下问题

PropertyValuesHolder:找不到属性的 setter/getter 值类型为 float

如果我将.ofFloat(...) 替换为ofInt(....),则效果很好

使用ofInt(....),动画不流畅。

我还检查了PropertyValuesHolder: Couldn't find setter/getter for property alpha with value type float 发布的解决方案

但是这个解决方案对我不起作用,因为我将动画应用于自定义可绘制对象。

可以解释一下在使用 ofFloat(....) 时出现此错误的原因。什么是替代解决方案。提前致谢。

【问题讨论】:

  • 你解决过这个问题吗?

标签: android animation android-animation objectanimator


【解决方案1】:

同样的问题。

这样解决:

final ObjectAnimator animScrollToBottom = ObjectAnimator.ofInt(AnimatorProxy.wrap(scrollView), "scrollY", fromPositionInt, toPositionInt).setDuration(500);

或使用浮点值:

final ObjectAnimator animScrollToBottom = ObjectAnimator.ofFloat(scrollView, "y", fromPositionInt,toPositionInt).setDuration(500);

【讨论】:

  • 谢谢,AnimatorProxy.wrap(view) 帮忙了。
猜你喜欢
  • 1970-01-01
  • 2013-11-02
  • 1970-01-01
  • 2018-06-20
  • 1970-01-01
  • 1970-01-01
  • 2011-01-09
  • 1970-01-01
  • 2016-06-12
相关资源
最近更新 更多