0

I dont get it why wew need to put icons in mipmap. Found this lint rule also https://googlesamples.github.io/android-custom-lint-rules/checks/MipmapIcons.md.html but it does not mention SVG files.

Thats what I want to do. To use SVG for launcher icon. I have added one in drawables folder and used it like this

    <application
        android:name=".App"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/Theme.App">

And it works fine ontil api lvl 25 enter image description here

But it is zoomed in on API lvls above 25 enter image description here

To suspport older APIss I have added 2 of same svg I have added 3 files. ic_launcher and ic_launcher_v26 are same svg icons and in second ic_launcher I have this xml code

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

launcher icon xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="192dp"
    android:height="192dp"
    android:viewportWidth="192"
    android:viewportHeight="192">
  <path
      android:pathData="M0,0h192v192h-192z"
      android:fillColor="#e6e7e8"/>
  <path
      android:pathData="M0,0h96v96h-96z"
      android:fillColor="#38bca7"/>
  <path
      android:pathData="M0,96h96v96h-96z"
      android:fillColor="#e0b025"/>
  <path
      android:pathData="M96,0h96v96h-96z"
      android:fillColor="#c43948"/>
  <path
      android:pathData="M48,48m-22.37,0a22.37,22.37 0,1 1,44.74 0a22.37,22.37 0,1 1,-44.74 0"
      android:fillColor="#fff"/>
  <path
      android:pathData="M144,25.04l-26.17,45.33l52.35,0l-26.18,-45.33z"
      android:fillColor="#fff"/>
  <path
      android:pathData="M25.63,121.62h44.75v44.75h-44.75z"
      android:fillColor="#fff"/>
  <path
      android:pathData="m151.49,150.64h17.04c-2.87,16.63 -12.49,24.95 -28.86,24.95 -7.94,0 -13.66,-1.78 -17.14,-5.34 -2.61,-2.6 -3.9,-6.08 -3.9,-10.47 0,-1.43 0.14,-2.97 0.41,-4.62l2.8,-15.92h-8.18l2.57,-14.47h8.14l1.64,-9.34 18.8,-7.8 -2.98,17.14h28.34l-2.56,14.47h-28.34l-2.06,11.61c-0.28,1.3 -0.41,2.46 -0.41,3.49 0,4.31 2.06,6.47 6.16,6.47 2.19,0 4.02,-0.93 5.5,-2.77 1.47,-1.84 2.48,-4.31 3.03,-7.39Z"
      android:fillColor="#38bca7"/>
</vector>

and here is what it looks like enter image description here

So is there a way to fix it? what would be an advantage to using png images over svg for launcher icon? minimum API lvl the app supports is 24

George Shalvashvili
  • 1,263
  • 13
  • 21
  • "And it works fine ontil api lvl 25 " -- there are hundreds of launchers just in terms of the pre-installed ones across tens of thousands of device models. There are hundreds more installable from the Play Store, F-Droid, and elsewhere. How many did you test? "So is there a way to fix it?" -- your [mcve] does not include the vector drawable. Perhaps there is an issue in how you sized it. – CommonsWare Mar 11 '23 at 13:00

0 Answers0