【问题标题】:AnimatorObject Path动画对象路径
【发布时间】:2018-05-17 03:35:06
【问题描述】:

我正在尝试使图像遵循定义的路径,但无法使路径正常工作。

我有这个:

val path_um:Path = Path("m250 250c-1.2 0.4 -1.9 1.7 -1.5 2.9")
val animation = ObjectAnimator.ofFloat(mImageView, "translationX", "translationY", path_um)

如何让它工作? 我错过了什么?


2017 年 12 月 3 日更新

Path 参数中存在类型不匹配。它说它是一个字符串而不是路径。我不知道如何转换为路径。

这条路径已经在一个向量中,作为一条路径,但我不知道如何让路径元素沿着另一条路径移动。有这方面的参考吗?

【问题讨论】:

  • animation.setDuration();动画.setInteroperation();动画.start();
  • 并且,确保您是动画“translationX”属性或“x”属性。相对或绝对位置,看来你应该使用绝对位置,请参考:android-coding.blogspot.com/2015/02/…

标签: android animation path


【解决方案1】:

您可以尝试在xml文件中定义它。它更容易。而你的异常没有开始

【讨论】:

    猜你喜欢
    • 2023-03-25
    • 2019-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多