自适应图标前景未按比例缩小?

时间:2019-04-28 13:52:29

标签: android

尝试实现自适应启动器图标,但似乎无法正常工作:

ic_launcher.xml

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/launcher_background"/>
    <foreground android:drawable="@drawable/launcher_foreground"/>
</adaptive-icon>

launcher_background.xml

<shape android:shape="oval"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/colorPrimary"/>
</shape>

launcher_foreground.xml

<vector android:height="108dp" android:viewportHeight="108"
    android:viewportWidth="108" android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#fff" android:pathData="M58.26,0.75C57.15,1.47 56,2.21 54.87,3A66.72,66.72 0,0 0,49 7.81a72.67,72.67 0,0 1,1.31 13.78A72.6,72.6 0,0 0,49 7.81a93.39,93.39 0,0 0,-7.25 7.51A130.1,130.1 0,0 0,24.93 39.83,66.17 66.17,0 0,0 20.06,51a25.79,25.79 0,0 0,-0.76 2.87,9.66 9.66,0 0,0 0.41,4.62 12.21,12.21 0,0 0,0.43 1.2,14.53 14.53,0 0,0 0.66,1.38c0.31,0.56 0.65,1.11 1,1.65A34.4,34.4 0,0 0,31 71.58a58.81,58.81 0,0 0,5.34 3.28c0.07,-0.67 0.16,-1.34 0.25,-2 -0.09,0.66 -0.18,1.32 -0.25,2a63.23,63.23 0,0 0,11 4.67c0.14,-2.36 0.37,-4.66 0.72,-6.9a57,57 0,0 1,6.14 -18.69,56.35 56.35,0 0,0 5.44,-14.82c0.16,-0.66 0.31,-1.53 0.46,-2.16h0A57.7,57.7 0,0 0,61.58 24,71.28 71.28,0 0,0 58.26,0.75ZM50.31,23.75v0Z"/>
    <path android:fillColor="#fff" android:pathData="M90.94,49.15c-0.13,-0.4 -0.27,-0.8 -0.43,-1.19a12.57,12.57 0,0 0,-0.67 -1.38c-0.31,-0.57 -0.65,-1.12 -1,-1.65a34.29,34.29 0,0 0,-9.17 -8.87,59.53 59.53,0 0,0 -5.33,-3.28c-0.12,1.07 -0.25,2.12 -0.41,3.15a60.38,60.38 0,0 1,-3.16 12.16,60.38 60.38,0 0,0 3.16,-12.16c0.16,-1 0.29,-2.08 0.41,-3.15a62.21,62.21 0,0 0,-11 -4.66c-0.13,2.35 -0.37,4.66 -0.71,6.89A57.05,57.05 0,0 1,56.49 53.7a56.68,56.68 0,0 0,-5.44 14.79c-0.15,0.66 -0.31,1.49 -0.45,2.12h0a58.63,58.63 0,0 0,-1.53 13,71.47 71.47,0 0,0 3.33,23.28c1.11,-0.72 2.27,-1.45 3.36,-2.24a72.45,72.45 0,0 0,5.82 -4.81h0a71.44,71.44 0,0 0,7.29 -7.5A130.54,130.54 0,0 0,85.7 67.81a66.47,66.47 0,0 0,4.88 -11.16,26.55 26.55,0 0,0 0.76,-2.88A9.68,9.68 0,0 0,90.94 49.15ZM60.33,83.91v0ZM60.33,84.48h0c0,0.5 0,1 0,1.56C60.29,85.5 60.31,85 60.31,84.48ZM61.62,72.78q0.12,-0.65 0.27,-1.32h0C61.77,71.92 61.68,72.35 61.6,72.78ZM62.35,69.37c0,0.12 0,0.23 -0.08,0.35 0,-0.12 0,-0.24 0.08,-0.35a59.51,59.51 0,0 1,4.92 -13.79A59.51,59.51 0,0 0,62.33 69.37Z"/>
</vector>

清单:

  <application
        ...
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher"
        >

结果:

enter image description here

同时在我的真实设备(API 27)和模拟器(API 28)上发生

0 个答案:

没有答案