1
我從https://romannurik.github.io/AndroidIconAnimator/導出一個動畫矢量。在一個文件中的Android動畫矢量編譯錯誤
生成的文件是
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="510dp"
android:height="510dp"
android:viewportWidth="510"
android:viewportHeight="510"
android:alpha="1">
<group android:name="group">
<group android:name="play_circle_outline">
<path
android:name="path"
android:pathData="M 204 369.75 L 357 255 L 204 140.25 L 204 369.75 Z M 255 0 C 114.75 0 0 114.75 0 255 C 0 395.25 114.75 510 255 510 C 395.25 510 510 395.25 510 255 C 510 114.75 395.25 0 255 0 Z M 255 459 C 142.8 459 51 367.2 51 255 C 51 142.8 142.8 51 255 51 C 367.2 51 459 142.8 459 255 C 459 367.2 367.2 459 255 459 Z"
android:strokeColor="#000000"/>
</group>
</group>
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="path"
android:propertyName="pathData"
android:startOffset="200"
android:duration="1000"
android:valueFrom="M 204 369.75 L 357 255 L 204 140.25 L 204 369.75 Z M 255 0 C 114.75 0 0 114.75 0 255 C 0 395.25 114.75 510 255 510 C 395.25 510 510 395.25 510 255 C 510 114.75 395.25 0 255 0 Z M 255 459 C 142.8 459 51 367.2 51 255 C 51 142.8 142.8 51 255 51 C 367.2 51 459 142.8 459 255 C 459 367.2 367.2 459 255 459 Z"
android:valueTo="M 204 369.75 L 360 180 L 204 369.75 L 150 336.75 Z M 255 0 C 114.75 0 0 114.75 0 255 C 0 395.25 114.75 510 255 510 C 395.25 510 510 395.25 510 255 C 510 114.75 395.25 0 255 0 Z M 255 459 C 142.8 459 51 367.2 51 255 C 51 142.8 142.8 51 255 51 C 367.2 51 459 142.8 459 255 C 459 367.2 367.2 459 255 459 Z"
android:valueType="pathType"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"/>
</aapt:attr>
</target>
</animated-vector>
但它給時,即時通訊將在Android Studio中的文件的多個錯誤。
第一個錯誤是: 元素動畫矢量並不需要attrbute android:drawable。在第4行 第二個錯誤是:
屬性丟失了Android命名空間前綴
和在線22動畫屬性應該定義。
爲什麼發生這些錯誤?
我看到了https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html,這裏的一部分文件幾乎相同。