我找不出为什么我的动画矢量不起作用。我可以看到第一个路径,但第二个路径是我想要添加第一个路径的动画,但未显示。这是我的代码看起来像:动画矢量可绘制动画不起作用
<?xml version="1.0" encoding="utf-8"?>
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:height="24dp"
android:width="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0" >
<path
android:name="v"
android:strokeColor="#000000"
android:strokeWidth="3"
android:pathData="M6,11 l3.5, 4 l0, 0" />
</vector>
</aapt:attr>
<target android:name="v" >
<aapt:attr name="android:animation">
<set>
<objectAnimator
android:duration="1000"
android:propertyName="pathData"
android:valueFrom="M6,11 l3.5, 4 l0, 0"
android:valueTo="M6,11 l3.5, 4 l8, -7"
android:valueType="pathType"/>
</set>
</aapt:attr>
</target>
</animated-vector>
所以,M6,11 l3.5, 4 l0, 0
正显示在屏幕上,但不M6,11 l3.5, 4 l8, -7
我试图复制例如,从谷歌文档here的底部并没有工作。如果我使用他们的代码告诉我我正确地开始动画,我的文件就会正确地动画。这是我的路径数据的错字或错误吗?
通过使用'android:src'而不是'app:srcCompat',你实际上绕过了支持库,所以它的版本根本不相关。不过要小心,不使用支持库,你的drawable将会在21以下的API上崩溃。 –