REQUEST Trying to add Gradient to the vector bell

HellzBellz

Well-known member
Joined
Oct 30, 2022
Messages
208
Awards
3
Offline
I'm having a problem trying to code a gradient on the vector bell, I don't know if it's my code or it just don't work in AS.

I tried to create 2 xml files for the gradient and for the vector and tried to use this code to insert it.
Code:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:bottom="@dimen/_5sdp"
        android:drawable="@drawable/My_Grad.xml"
        android:left="@dimen/_5sdp"
        android:right="@dimen/_5sdp"
        android:top="@dimen/_5sdp" />
    <item
        android:bottom="@dimen/_5sdp"
        android:drawable="@drawable/My_Vect.xml"
        android:left="@dimen/_5sdp"
        android:right="@dimen/_5sdp"
        android:top="@dimen/_5sdp" />
</layer-list>

and this code
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="20.0dip" android:width="20.0dip" android:viewportWidth="511.63" android:viewportHeight="511.63"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#fffefb06" android:pathData="M411.404,288.506c-18.455,-45.014 -27.685,-92.455 -27.685,-142.325c0,-31.405 -9.131,-56.337 -27.398,-74.802c-18.28,-18.464 -43.406,-29.602 -75.383,-33.407c1.52,-3.424 2.279,-6.945 2.279,-10.562c0,-7.614 -2.663,-14.091 -7.991,-19.416C269.898,2.663 263.427,0 255.812,0c-7.61,0 -14.083,2.663 -19.414,7.994c-5.33,5.329 -7.993,11.802 -7.993,19.416c0,3.617 0.76,7.135 2.285,10.562c-31.977,3.809 -57.103,14.942 -75.375,33.407c-18.271,18.464 -27.406,43.396 -27.406,74.802c0,49.87 -9.229,97.311 -27.694,142.325c-18.464,45.015 -45.776,82.847 -81.942,113.492c0,9.896 3.617,18.463 10.85,25.693c7.232,7.231 15.796,10.852 25.697,10.852h127.907c0,20.178 7.135,37.404 21.411,51.675c14.277,14.273 31.504,21.412 51.678,21.412c20.177,0 37.404,-7.139 51.675,-21.412c14.273,-14.271 21.412,-31.497 21.412,-51.675H456.81c9.897,0 18.47,-3.613 25.694,-10.852c7.234,-7.23 10.852,-15.797 10.852,-25.693C457.196,371.353 429.881,333.521 411.404,288.506zM255.816,488.787c-13.894,0 -25.747,-4.896 -35.548,-14.698c-9.801,-9.804 -14.703,-21.658 -14.703,-35.553c0,-3.046 1.524,-4.568 4.568,-4.568c3.046,0 4.57,1.522 4.57,4.568c0,11.231 4.043,20.889 12.132,28.982c8.091,8.094 17.749,12.135 28.98,12.135c3.046,0 4.575,1.53 4.575,4.569C260.392,487.268 258.862,488.787 255.816,488.787z" />

<shape
  xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#fffd2b32" android:endColor="#ff02af4d" android:angle="135.0" android:centerColor="#ffa9a655" />
</shape>
</vector>

Neither worked any help?
Thank you!
 

HellzBellz

Well-known member
Joined
Oct 30, 2022
Messages
208
Awards
3
Offline
Just change the xml to a png.
Yea i don't know how to do that yet :( How would i convert this ot image?

Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="20.0dip" android:width="20.0dip" android:viewportWidth="511.63" android:viewportHeight="511.63"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#fffcf909" android:pathData="M411.404,288.506c-18.455,-45.014 -27.685,-92.455 -27.685,-142.325c0,-31.405 -9.131,-56.337 -27.398,-74.802c-18.28,-18.464 -43.406,-29.602 -75.383,-33.407c1.52,-3.424 2.279,-6.945 2.279,-10.562c0,-7.614 -2.663,-14.091 -7.991,-19.416C269.898,2.663 263.427,0 255.812,0c-7.61,0 -14.083,2.663 -19.414,7.994c-5.33,5.329 -7.993,11.802 -7.993,19.416c0,3.617 0.76,7.135 2.285,10.562c-31.977,3.809 -57.103,14.942 -75.375,33.407c-18.271,18.464 -27.406,43.396 -27.406,74.802c0,49.87 -9.229,97.311 -27.694,142.325c-18.464,45.015 -45.776,82.847 -81.942,113.492c0,9.896 3.617,18.463 10.85,25.693c7.232,7.231 15.796,10.852 25.697,10.852h127.907c0,20.178 7.135,37.404 21.411,51.675c14.277,14.273 31.504,21.412 51.678,21.412c20.177,0 37.404,-7.139 51.675,-21.412c14.273,-14.271 21.412,-31.497 21.412,-51.675H456.81c9.897,0 18.47,-3.613 25.694,-10.852c7.234,-7.23 10.852,-15.797 10.852,-25.693C457.196,371.353 429.881,333.521 411.404,288.506zM255.816,488.787c-13.894,0 -25.747,-4.896 -35.548,-14.698c-9.801,-9.804 -14.703,-21.658 -14.703,-35.553c0,-3.046 1.524,-4.568 4.568,-4.568c3.046,0 4.57,1.522 4.57,4.568c0,11.231 4.043,20.889 12.132,28.982c8.091,8.094 17.749,12.135 28.98,12.135c3.046,0 4.575,1.53 4.575,4.569C260.392,487.268 258.862,488.787 255.816,488.787z" />
</vector>
 
Last edited:

atomant247

Active member
VIP Member
Joined
Apr 25, 2021
Messages
286
Awards
2
Offline
Not sure what editor you're using but here is apk editor. Click on the xml, choose detail. Rename the xml to png. Then come out of the folder then back in and add your png to the one you have renamed.
Screenshot_20221225_020655_APK Editor Plus.jpg
 
Top