小编Jul*_*rst的帖子

AnimatedVectorDrawable不动画

我试图让动画vectorDrawables工作,并根据http://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html做了一切,它仍然无法正常工作.

我也试图让这个项目有效. https://github.com/chiuki/animated-vector-drawable

有谁知道它为什么没有动画?

这是我使用的文件:

AnimatedVectorDrawable

<animated-vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/circle">
?
    <target
        android:name="circle"
        android:animation="@anim/morph_to_drop"/>
?
</animated-vector>
Run Code Online (Sandbox Code Playgroud)

VectorDrawable

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="80dp"
        android:height="80dp"
        android:viewportHeight="50"
        android:viewportWidth="50">
?
    <path
        android:name="circle"
        android:fillColor="#607eff"
        android:pathData="M15.9,0c8.776,0 15.9,7.125 15.9,15.9c0,8.776 -7.124,16.015 -15.9,16.015c-8.775,0
-15.9,-7.239 -15.9,-16.015c0,-8.775 7.125,-15.9 15.9,-15.9Z"/>
?
</vector>
Run Code Online (Sandbox Code Playgroud)

动画师(morph_to_drop)

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator
        android:duration="1000"
        android:propertyName="pathData"
        android:valueFrom="M15.9,0c8.776,0 15.9,7.125 15.9,15.9c0,8.776 -7.124,16.015 -15.9,16.015c-8.775,0
-15.9,-7.239 -15.9,-16.015c0,-8.775 7.125,-15.9 15.9,-15.9Z"
        android:valueTo="M15.9,0c8.776,0 15.9,7.125 15.9,15.9c0,8.776 -12.626,30.167
-15.707,30.143c-3.08,-0.024 -16.093,-21.367 -16.093,-30.143c0,-8.775 7.125,-15.9
15.9,-15.9Z"
        android:valueType="pathType"/>
</set>
Run Code Online (Sandbox Code Playgroud)

主要布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
?
    <ImageView
        android:id="@+id/testImage" …
Run Code Online (Sandbox Code Playgroud)

animation android android-vectordrawable

13
推荐指数
1
解决办法
3387
查看次数