我需要使用渐变为矢量中的路径设置动画,但是我找不到解决方法。任何帮助表示赞赏。
<?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:name="vector"
android:width="80dp"
android:height="88dp"
android:viewportWidth="80"
android:viewportHeight="88">
<path
android:name="curve"
android:pathData="M79.6,54.8623V54.3618C79.7,52.8601 79.8,50.9579 79.9,48.8555V48.6553C79.9,47.1536 80,45.6519 80,44.0501C80,42.4482 80,40.8464 79.9,39.4448V39.2446C79.8,37.1422 79.7,35.24 79.6,33.7383V32.537C79.5,30.9352 79.4,29.934 79.4,29.8339C79.4,29.6337 79.4,29.5336 79.3,29.3333V29.2332C79.3,28.9329 79.2,28.6325 79.2,28.4323V28.3322C78.5,24.9283 76.6,21.2241 74.3,18.521C73.4,17.4198 72.4,16.5188 71.4,15.7179C71.3,15.6177 70.2,14.8168 68.3,13.5154C66.1,12.0137 63.0999,10.0114 59.5999,8.0091C53.5,4.3049 48,1.802 47.2999,1.5017H47.2C45.6,0.8009 43.5999,0.3003 41.5,0.1001C41.0999,0.1001 40.7,0 40.2999,0H38.5999C35.7999,0.1001 33.2,0.6007 31.1,1.5017C30.8,1.6018 25.2999,4.1047 19,7.8089C19,7.8089 18.9,7.909 18.7999,7.909C12.4,11.7133 7.3,15.4175 7.0999,15.6177C5.4999,16.8191 4.0999,18.3208 2.7999,20.223C2.4999,20.6234 2.4999,21.7247 3.7999,21.7247H6.9999C8.4,21.7247 8.7,20.9238 10.2,19.8225C11.9,18.6212 15.2,16.1183 21.4,12.4141C25.7999,9.8111 30,7.7088 32,6.8077C32,6.8077 32.0999,6.8077 32.0999,6.7076H32.4C32.9,6.5074 33.2,6.3072 33.2,6.3072C34.6,5.7065 36.6,5.306 38.7,5.2059H39.5C40.0999,5.2059 40.7,5.306 41.2999,5.306C42.5999,5.5063 43.7,5.7065 44.7,6.1069C44.7999,6.1069 44.9,6.207 45,6.207C45,6.207 45.1,6.207 45.2,6.3072C46.1,6.7076 51.3,9.1103 56.9,12.4141C60.2,14.3163 63.1999,16.3185 65.1999,17.7201C66.9999,18.9215 68.1,19.7224 68.1,19.8225C68.9,20.4232 69.7,21.2241 70.4,22.1251C72.3,24.5279 73.8,27.8316 74,30.3345C74,30.3345 74.1,31.4357 74.2,33.0375V36.4414C74.2999,38.6439 74.4,41.1468 74.4,43.8498C74.4,46.5529 74.2999,49.1559 74.2,51.2582V54.6621C74.1,56.364 74,57.3652 74,57.3652C73.7,59.868 72.2,63.1718 70.4,65.5745C69.7,66.4755 68.9,67.3766 68.1,67.8771C68.1,67.8771 66.9999,68.678 65.1999,69.9795C63.1999,71.3811 60.2,73.3834 56.9,75.2855C51.3,78.5893 46.1,80.992 45.2,81.3925C45.1,81.3925 45.0999,81.4926 45,81.4926C44.9,81.4926 44.7999,81.5927 44.7,81.5927C43.7999,81.9932 42.5999,82.2935 41.2999,82.3936C40.7,82.4937 40.0999,82.4937 39.5,82.4937H38.7C36.6,82.4937 34.6,82.0933 33.2,81.3925C33.2,81.3925 32.9,81.2924 32.4,80.992C32.3,80.992 32.3,80.8919 32.2,80.8919C32.2,80.8919 32.0999,80.8919 32.0999,80.7918H32C32,80.7918 31.9,80.7918 31.9,80.6917C31.7999,80.6917 31.8,80.6917 31.7,80.5916C29.6,79.5904 25.5999,77.5882 21.4,75.0853C15.2,71.4812 11.9,68.9784 10.2,67.6769C8.7,66.9761 8.4,66.1752 6.9999,66.1752H3.9C2.6,66.1752 2.6999,67.2764 2.9,67.6769C4.2,69.5791 5.5999,71.0808 7.2,72.2821C7.4,72.4824 12.5,76.1866 18.9,79.9909C19.1999,80.1911 19.6,80.3913 19.9,80.5916C25.7999,83.9954 30.9,86.2981 31.2,86.4983C33.2,87.3993 35.9,88 38.7,88H40.4C40.8,88 41.1999,88 41.5999,87.8999C43.6999,87.6997 45.7,87.1991 47.2999,86.4983H47.4C48.1,86.198 53.6,83.6951 59.7,80.091C63.1,78.0887 66.2,76.0865 68.3,74.5848C70.1,73.2833 71.3,72.4824 71.4,72.3823C72.4,71.6815 73.4,70.6803 74.3,69.5791C76.6,66.7759 78.5,63.0717 79.2,59.7679V59.6678C79.2999,59.3675 79.3,59.0671 79.3,58.8669V58.7668C79.3,58.5666 79.3,58.4664 79.4,58.2662C79.4,58.1661 79.5,57.165 79.6,55.5631V54.8623Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="-0.32032"
android:startX="41.2774"
android:endY="87.8803"
android:endX="41.2774"
android:type="linear">
<item android:offset="0" android:color="#FF666666"/>
<item android:offset="0.4" android:color="#FF777777"/>
<item android:offset="0.66" android:color="#FF818181"/>
<item android:offset="1" android:color="#FF919191"/>
</gradient>
</aapt:attr>
</path>
</vector>
</aapt:attr>
<target
android:name="curve" >
<!-- There should be an animated gradient -->
</target>
</animated-vector>
解决方案不必位于XML文件中,也可以位于代码中。