我的载体:
<vector android:height="100dp" android:viewportHeight="386.999"
android:viewportWidth="584.999" android:width="150dp"
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:pathData="M21.999,0.125h540c12.428,0 22.5,10.073 22.5,22.5v341.999c0,12.426 -10.072,22.5 -22.5,22.5h-540c-12.426,0 -22.499,-10.074 -22.499,-22.5V22.625C-0.5,10.198 9.573,0.125 21.999,0.125z">
<aapt:attr name="android:fillColor">
<gradient android:endX="502.2204" android:endY="444.1562"
android:startX="81.7783" android:startY="-56.9072" android:type="linear">
<item android:color="#FFF2612E" android:offset="0"/>
<item android:color="#FFF6871F" android:offset="1"/>
</gradient>
</aapt:attr>
</path>
<path android:fillAlpha="0.1" android:fillColor="#00000000"
android:fillType="evenOdd"
android:pathData="M35.5,11.375h512.999c12.426,0 22.5,10.073 22.5,22.5v319.499c0,12.427 -10.074,22.501 -22.5,22.501H35.5c-12.426,0 -22.5,-10.074 -22.5,-22.501V33.875C12.999,21.448 23.073,11.375 35.5,11.375z"
android:strokeAlpha="0.1" android:strokeColor="#000000" android:strokeWidth="4"/>
</vector>
我想以编程方式为2个项目分配颜色
<item android:color="#FFF2612E" android:offset="0"/>
<item android:color="#FFF6871F" android:offset="1"/>
我在这里搜索,但没有找到我想要的东西。 Dynamically change SVG image color in android
https://medium.com/@emmaguy/dynamically-changing-svg-colours-on-android-b026a99137ad