4

您好,有人可以告诉我如何在 android 的图标启动器中添加阴影吗?我有以下 mipmap 启动器图标:

任何dpi.xml

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

ic_launcher_background.xml

<resources>
    <color name="ic_launcher_background">#448AFF</color>
</resources>

ic_launcher_foreground.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="1347.3684"
android:viewportHeight="1347.3684">


<group android:translateX="417.6842"
      android:translateY="417.6842">
      <path android:fillColor="#424A60" android:pathData="M445.793,512H128V0h317.793c9.754,0 17.655,7.901 17.655,17.655v476.69C463.448,504.099 455.548,512 445.793,512"/>
      <path android:fillColor="#586789" android:pathData="M128,512H92.69c-9.754,0 -17.655,-7.901 -17.655,-17.655V17.655C75.034,7.901 82.935,0 92.69,0H128V512z"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,52.966h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828S97.562,52.966 92.69,52.966"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,123.586h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828S97.562,123.586 92.69,123.586"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,194.207h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828C101.517,190.261 97.562,194.207 92.69,194.207"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,264.828h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828S97.562,264.828 92.69,264.828"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,335.448h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828C101.517,331.502 97.562,335.448 92.69,335.448"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,406.069h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828C101.517,402.123 97.562,406.069 92.69,406.069"/>
      <path android:fillColor="#CCD0D2" android:pathData="M92.69,476.69h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828C101.517,472.744 97.562,476.69 92.69,476.69"/>
      <path android:fillColor="#25AE88" android:pathData="M331.034,406.069c0,-29.255 -23.711,-52.966 -52.966,-52.966s-52.966,23.711 -52.966,52.966s23.711,52.966 52.966,52.966S331.034,435.324 331.034,406.069"/>
      <path android:fillColor="#CC4B4C" android:pathData="M348.69,344.276v35.31h-24.797c4.511,7.795 7.142,16.825 7.142,26.483c0,7.274 -1.474,14.204 -4.122,20.515c6.444,3.69 13.815,5.967 21.778,5.967c24.373,0 44.138,-19.765 44.138,-44.138S373.063,344.276 348.69,344.276"/>
      <path android:fillColor="#F0CE49" android:pathData="M260.414,291.31v23.499l19.897,7.239l-11.626,31.938c3.054,-0.547 6.179,-0.883 9.384,-0.883c19.597,0 36.661,10.664 45.824,26.483h24.797V291.31H260.414z"/>
      <path android:fillColor="#CC4B4C" android:pathData="M268.687,353.983l11.626,-31.929l-66.366,-24.152l-24.152,66.357l42.39,15.431C239.838,366.412 253.062,356.781 268.687,353.983"/>
      <path android:fillColor="#586789" android:pathData="M278.069,97.103h-88.276c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h88.276c4.873,0 8.828,3.946 8.828,8.828S282.942,97.103 278.069,97.103"/>
      <path android:fillColor="#586789" android:pathData="M401.655,158.897h-61.793c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h61.793c4.873,0 8.828,3.946 8.828,8.828S406.528,158.897 401.655,158.897"/>
      <path android:fillColor="#586789" android:pathData="M286.901,158.897h-61.793c-4.882,0 -8.828,-3.946 -8.828,-8.828s3.946,-8.828 8.828,-8.828h61.793c4.873,0 8.828,3.946 8.828,8.828S291.774,158.897 286.901,158.897"/>
      <path android:fillColor="#586789" android:pathData="M189.793,158.897h-17.655c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h17.655c4.873,0 8.828,3.946 8.828,8.828S194.666,158.897 189.793,158.897"/>
      <path android:fillColor="#586789" android:pathData="M401.655,194.207H384c-4.873,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.955,-8.828 8.828,-8.828h17.655c4.873,0 8.828,3.946 8.828,8.828C410.483,190.261 406.528,194.207 401.655,194.207"/>
      <path android:fillColor="#586789" android:pathData="M348.69,194.207h-88.276c-4.873,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.955,-8.828 8.828,-8.828h88.276c4.873,0 8.828,3.946 8.828,8.828C357.517,190.261 353.562,194.207 348.69,194.207"/>
      <path android:fillColor="#586789" android:pathData="M207.453,194.207h-35.31c-4.882,0 -8.828,-3.946 -8.828,-8.828c0,-4.882 3.946,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828C216.28,190.261 212.326,194.207 207.453,194.207"/>
      <path android:fillColor="#586789" android:pathData="M401.655,229.517h-88.276c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h88.276c4.873,0 8.828,3.946 8.828,8.828S406.528,229.517 401.655,229.517"/>
      <path android:fillColor="#586789" android:pathData="M260.414,229.517h-35.31c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h35.31c4.873,0 8.828,3.946 8.828,8.828S265.287,229.517 260.414,229.517"/>
      <path android:fillColor="#586789" android:pathData="M189.793,229.517h-17.655c-4.873,0 -8.828,-3.946 -8.828,-8.828s3.955,-8.828 8.828,-8.828h17.655c4.873,0 8.828,3.946 8.828,8.828S194.666,229.517 189.793,229.517"/>
  </group>
</vector>

这段代码的输出是这样的:

实际输出

但是,我希望它得到这样的阴影:

期望的输出

请不要建议我使用此链接:Android Asset Launcher Icon,因为我已经尝试过了,但我不喜欢它,因为它将图标转换为图像而不是矢量可绘制对象,并且它不支持自适应图标。我只想要矢量绘图答案。

请帮我。

4

0 回答 0