Android - objectAnimator xml alpha 动画不工作

标签 android xml vector alpha objectanimator

使用 alpha 作为 objectAnimatorpropertyName 根本没有任何作用。 objectAnimator 连接到 vector 内的 path

fading_animator.xml:

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator
        android:duration="700"
        android:propertyName="alpha"
        android:valueFrom="1"
        android:valueTo="0"
        android:valueType="floatType"
        android:repeatCount="infinite"
        android:repeatMode="restart"/>
</set>

animated_vector.xml:

<animated-vector
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:drawable="@drawable/vector_drawable">

  <target
    android:name="pathTarget"
    android:animation="@animator/fading_animator"/>

</animated-vector>

最佳答案

当尝试为路径的 alpha 设置动画时,您必须使用 fillAlphastrokeAlpha。同样,scaleXscaleY 不会在 path 上工作,但会在 内的 group 上工作>向量

关于Android - objectAnimator xml alpha 动画不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41981574/

相关文章:

android - TextView 使用 constraintLayout 离开屏幕

java - 在后台服务中每 n 分钟运行一次任务

c# - 将 List<T> 保存到 XML 文件

android - 我的 Android 应用程序没有显示在应用程序抽屉中?

android - 从拨号器打开 Android 应用程序

xml - ColdFusion 问题 : Reading Value of XML Child as Empty String

php - magento配置系统文件困惑

r - 从r中矩阵的每一行中减去常数向量

c++ - 这段代码的递归形式是什么?

C++,给vector::end赋值?