D
D
Dutymy2021-08-11 19:18:29
android studio
Dutymy, 2021-08-11 19:18:29

How to put an image on the application icon?

Hello, I put the following code in ic_launcher_foreground.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="108dp"
    android:height="108dp"
    android:viewportWidth="58"
    android:viewportHeight="58">
  <path
      android:pathData="M39.774,53.5H18.226c-0.224,0 -0.311,-0.307 -0.124,-0.437l1.805,-1.273c1.947,-1.373 2.868,-3.891 2.3,-6.29v0h13.588l0,0.002c-0.568,2.4 0.354,4.917 2.302,6.29l1.803,1.271C40.085,53.194 39.997,53.5 39.774,53.5z"
      android:fillColor="#AFB6BB"/>
  <path
      android:pathData="M54.502,45.5H3.498C1.566,45.5 0,43.934 0,42.002V4.998C0,3.066 1.566,1.5 3.498,1.5h51.003C56.434,1.5 58,3.066 58,4.998v37.003C58,43.934 56.434,45.5 54.502,45.5z"
      android:fillColor="#E7ECED"/>
  <path
      android:pathData="M58,36.5H0V4.998C0,3.066 1.566,1.5 3.498,1.5h51.003C56.434,1.5 58,3.066 58,4.998V36.5z"
      android:fillColor="#38454F"/>
  <path
      android:pathData="M4,10.5c0.256,0 0.512,-0.098 0.707,-0.293l4,-4c0.391,-0.391 0.391,-1.023 0,-1.414s-1.023,-0.391 -1.414,0l-4,4c-0.391,0.391 -0.391,1.023 0,1.414C3.488,10.402 3.744,10.5 4,10.5z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M4,15.5c0.256,0 0.512,-0.098 0.707,-0.293l2,-2c0.391,-0.391 0.391,-1.023 0,-1.414s-1.023,-0.391 -1.414,0l-2,2c-0.391,0.391 -0.391,1.023 0,1.414C3.488,15.402 3.744,15.5 4,15.5z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M7.29,9.79C7.109,9.98 7,10.24 7,10.5c0,0.26 0.109,0.52 0.29,0.71C7.479,11.39 7.729,11.5 8,11.5c0.26,0 0.52,-0.11 0.71,-0.29C8.89,11.02 9,10.76 9,10.5c0,-0.26 -0.11,-0.52 -0.29,-0.71C8.33,9.42 7.67,9.42 7.29,9.79z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M9.293,9.207C9.488,9.402 9.744,9.5 10,9.5s0.512,-0.098 0.707,-0.293l3,-3c0.391,-0.391 0.391,-1.023 0,-1.414s-1.023,-0.391 -1.414,0l-3,3C8.902,8.184 8.902,8.816 9.293,9.207z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M12.293,9.793l-9,9c-0.391,0.391 -0.391,1.023 0,1.414C3.488,20.402 3.744,20.5 4,20.5s0.512,-0.098 0.707,-0.293l9,-9c0.391,-0.391 0.391,-1.023 0,-1.414S12.684,9.402 12.293,9.793z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M14.29,7.79C14.109,7.98 14,8.23 14,8.5s0.109,0.52 0.29,0.71C14.479,9.39 14.729,9.5 15,9.5c0.27,0 0.52,-0.11 0.71,-0.29C15.89,9.02 16,8.77 16,8.5s-0.11,-0.52 -0.29,-0.71C15.34,7.42 14.66,7.42 14.29,7.79z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M18.707,4.793c-0.391,-0.391 -1.023,-0.391 -1.414,0l-1,1c-0.391,0.391 -0.391,1.023 0,1.414C16.488,7.402 16.744,7.5 17,7.5s0.512,-0.098 0.707,-0.293l1,-1C19.098,5.816 19.098,5.184 18.707,4.793z"
      android:fillColor="#839CAA"/>
  <path
      android:pathData="M40.5,56.5h-23c-0.825,0 -1.5,-0.675 -1.5,-1.5l0,0c0,-0.825 0.675,-1.5 1.5,-1.5h23c0.825,0 1.5,0.675 1.5,1.5l0,0C42,55.825 41.325,56.5 40.5,56.5z"
      android:fillColor="#E7ECED"/>
</vector>

But in ic_launcher.xml, the icon is not displayed correctly, 6113f824234a6978723746.png
why such a problem occurs if I did not change
android:width="108dp"
android:height="108dp"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question