java.lang.RuntimeException: Error while processing : Fraction values must be in the range 0 to 1: 2.0

huangapple go评论77阅读模式
英文:

java.lang.RuntimeException: Error while processing : Fraction values must be in the range 0 to 1: 2.0

问题

<vector android:height="24dp"
    android:viewportHeight="512"
    android:viewportWidth="512"
    android:width="24dp"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:aapt="http://schemas.android.com/aapt">
    <path android:pathData="m405.378,101.962c-41.146,-41.145 -95.851,-63.805 -154.038,-63.805s-112.893,22.66 -154.038,63.805c-41.144,41.145 -63.804,95.85 -63.804,154.038s22.66,112.893 63.804,154.038c41.146,41.144 95.851,63.804 154.038,63.804s112.893,-22.66 154.038,-63.804c41.144,-41.145 63.804,-95.851 63.804,-154.038s-22.66,-112.893 -63.804,-154.038zM251.34,448.314c-106.042,0 -192.314,-86.272 -192.314,-192.314s86.272,-192.314 192.314,-192.314 192.314,86.272 192.314,192.314 -86.272,192.314 -192.314,192.314z">
        <aapt:attr name="android:fillColor">
            <gradient android:endX="300" android:endY="600"
                android:startX="100" android:startY="100" android:type="linear">
                <item android:color="@color/colorAccent" android:offset="0.0"/>
                <item android:color="@color/custom_red" android:offset="2.0"/>
            </gradient>
        </aapt:attr>
    </path>
    <path  android:pathData="m251.34,166.225c18.346,-0 33.272,-14.926 33.272,-33.273 -0,-18.346 -14.926,-33.272 -33.272,-33.272s-33.272,14.926 -33.272,33.272c0,18.347 14.926,33.273 33.272,33.273zM251.34,125.209c4.27,-0 7.744,3.474 7.744,7.744s-3.474,7.744 -7.744,7.744 -7.744,-3.474 -7.744,-7.744c-0,-4.27 3.474,-7.744 7.744,-7.744z">
        <aapt:attr name="android:fillColor">
            <gradient android:endX="300" android:endY="600"
                android:startX="100" android:startY="100" android:type="linear">
                <item android:color="@color/colorAccent" android:offset="1.0"/>
                <item android:color="@color/custom_red" android:offset="1.0"/>
            </gradient>
        </aapt:attr>
    </path>
    <path  android:pathData="m284.612,348.32l-0,-133.336c-0,-18.346 -14.926,-33.272 -33.272,-33.272l-20.508,0c-18.347,0 -33.273,14.926 -33.273,33.272 0,13.827 8.478,25.711 20.509,30.726l0,133.337c0,18.346 14.926,33.273 33.272,33.273l20.508,-0c18.347,-0 33.273,-14.926 33.273,-33.273 -0.001,-13.827 -8.479,-25.711 -20.509,-30.727zM271.847,386.79l-20.508,0c-4.27,0 -7.744,-3.474 -7.744,-7.744l-0,-143.555c-0,-7.049 -5.715,-12.764 -12.764,-12.764 -4.27,0 -7.744,-3.474 -7.744,-7.744s3.474,-7.744 7.744,-7.744l20.508,-0c4.27,-0 7.744,3.474 7.744,7.744l0,143.555c0,7.049 5.715,12.764 12.764,12.764 4.27,-0 7.744,3.474 7.744,7.744 -0.001,4.271 -3.475,7.744 -7.744,7.744z">
        <aapt:attr name="android:fillColor">
            <gradient android:endX="300" android:endY="600"
                android:startX="200" android:startY="10" android:type="linear">
                <item android:color="@color/colorAccent"  android:offset="0.0"/>
                <item android:color="@color/custom_red" android:offset="1.0"/>
            </gradient>
        </aapt:attr>
    </path>
</vector>
英文:

The minSDK was 27 and that was fine but now I am set minSDK 21 and return error :

java.lang.RuntimeException: Error while processing : Fraction values must be in the range 0 to 1: 2.0

&lt;vector android:height=&quot;24dp&quot;
android:viewportHeight=&quot;512&quot;
android:viewportWidth=&quot;512&quot;
android:width=&quot;24dp&quot;
xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:aapt=&quot;http://schemas.android.com/aapt&quot;&gt;
&lt;path android:pathData=&quot;m405.378,101.962c-41.146,-41.145 -95.851,-63.805 -154.038,-63.805s-112.893,22.66 -154.038,63.805c-41.144,41.145 -63.804,95.85 -63.804,154.038s22.66,112.893 63.804,154.038c41.146,41.144 95.851,63.804 154.038,63.804s112.893,-22.66 154.038,-63.804c41.144,-41.145 63.804,-95.851 63.804,-154.038s-22.66,-112.893 -63.804,-154.038zM251.34,448.314c-106.042,0 -192.314,-86.272 -192.314,-192.314s86.272,-192.314 192.314,-192.314 192.314,86.272 192.314,192.314 -86.272,192.314 -192.314,192.314z&quot;&gt;
&lt;aapt:attr name=&quot;android:fillColor&quot;&gt;
&lt;gradient android:endX=&quot;300&quot; android:endY=&quot;600&quot;
android:startX=&quot;100&quot; android:startY=&quot;100&quot; android:type=&quot;linear&quot;&gt;
&lt;item android:color=&quot;@color/colorAccent&quot; android:offset=&quot;0.0&quot;/&gt;
&lt;item android:color=&quot;@color/custom_red&quot; android:offset=&quot;2.0&quot;/&gt;
&lt;/gradient&gt;
&lt;/aapt:attr&gt;
&lt;/path&gt;
&lt;path  android:pathData=&quot;m251.34,166.225c18.346,-0 33.272,-14.926 33.272,-33.273 -0,-18.346 -14.926,-33.272 -33.272,-33.272s-33.272,14.926 -33.272,33.272c0,18.347 14.926,33.273 33.272,33.273zM251.34,125.209c4.27,-0 7.744,3.474 7.744,7.744s-3.474,7.744 -7.744,7.744 -7.744,-3.474 -7.744,-7.744c-0,-4.27 3.474,-7.744 7.744,-7.744z&quot;&gt;
&lt;aapt:attr name=&quot;android:fillColor&quot;&gt;
&lt;gradient android:endX=&quot;300&quot; android:endY=&quot;600&quot;
android:startX=&quot;100&quot; android:startY=&quot;100&quot; android:type=&quot;linear&quot;&gt;
&lt;item android:color=&quot;@color/colorAccent&quot; android:offset=&quot;1.0&quot;/&gt;
&lt;item android:color=&quot;@color/custom_red&quot; android:offset=&quot;1.0&quot;/&gt;
&lt;/gradient&gt;
&lt;/aapt:attr&gt;
&lt;/path&gt;
&lt;path  android:pathData=&quot;m284.612,348.32l-0,-133.336c-0,-18.346 -14.926,-33.272 -33.272,-33.272l-20.508,0c-18.347,0 -33.273,14.926 -33.273,33.272 0,13.827 8.478,25.711 20.509,30.726l0,133.337c0,18.346 14.926,33.273 33.272,33.273l20.508,-0c18.347,-0 33.273,-14.926 33.273,-33.273 -0.001,-13.827 -8.479,-25.711 -20.509,-30.727zM271.847,386.79l-20.508,0c-4.27,0 -7.744,-3.474 -7.744,-7.744l-0,-143.555c-0,-7.049 -5.715,-12.764 -12.764,-12.764 -4.27,0 -7.744,-3.474 -7.744,-7.744s3.474,-7.744 7.744,-7.744l20.508,-0c4.27,-0 7.744,3.474 7.744,7.744l0,143.555c0,7.049 5.715,12.764 12.764,12.764 4.27,-0 7.744,3.474 7.744,7.744 -0.001,4.271 -3.475,7.744 -7.744,7.744z&quot;&gt;
&lt;aapt:attr name=&quot;android:fillColor&quot;&gt;
&lt;gradient android:endX=&quot;300&quot; android:endY=&quot;600&quot;
android:startX=&quot;200&quot; android:startY=&quot;10&quot; android:type=&quot;linear&quot;&gt;
&lt;item android:color=&quot;@color/colorAccent&quot;  android:offset=&quot;0.0&quot;/&gt;
&lt;item android:color=&quot;@color/custom_red&quot; android:offset=&quot;1.0&quot;/&gt;
&lt;/gradient&gt;
&lt;/aapt:attr&gt;
&lt;/path&gt;
&lt;/vector&gt;

答案1

得分: 1

尝试将以下行更改为:

<item android:color="@color/custom_red" android:offset="1.0"/>
英文:

Try to change the line

   &lt;item android:color=&quot;@color/custom_red&quot; android:offset=&quot;2.0&quot;/&gt;

into

   &lt;item android:color=&quot;@color/custom_red&quot; android:offset=&quot;1.0&quot;/&gt;

huangapple
  • 本文由 发表于 2020年9月10日 15:16:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/63824591.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定