2014-04-29 19 views

risposta

1

Prova a cliccare questo, spero che questo vi aiuterà;) enter image description here

+0

questo non ha funzionato per me – PowerMan2015

1

ho trovato due soluzioni per aggirare il chilo in più che Android Studio aggiunge durante la creazione di icone:

  1. ridimensionare le immagini utilizzando un [ Windows] file batch. Questo è quello che uso perché è il più facile per me (su Windows):

    a. Creare un ResizeImage.exe utilizzando il codice semplice da http://www.ianmcintyre.com/2014/06/c-resize-image-fit-image.html

    b. Salvare il seguente file ResizeAndroidLauncherImage.bat nella stessa directory di ResizeImage.exe. Copia l'immagine originale nelle varie directory e le ridimensiona:

    @echo off 
    setlocal 
    
    set subdir=%2 
    set iconsize=512 
    if not exist "%subdir%" mkdir "%subdir%" 
    copy /Y %1 %subdir%\ic_launcher-web.png 
    %~dp0ResizeImage.exe %subdir%\ic_launcher-web.png %iconsize% %iconsize% 
    
    set subdir=%2\res\mipmap-xxxhdpi 
    set iconsize=192 
    if not exist "%subdir%" mkdir "%subdir%" 
    copy /Y %1 %subdir%\ic_launcher.png 
    %~dp0ResizeImage.exe %subdir%\ic_launcher.png %iconsize% %iconsize% 
    
    set subdir=%2\res\mipmap-xxhdpi 
    set iconsize=144 
    if not exist "%subdir%" mkdir "%subdir%" 
    copy /Y %1 %subdir%\ic_launcher.png 
    %~dp0ResizeImage.exe %subdir%\ic_launcher.png %iconsize% %iconsize% 
    
    set subdir=%2\res\mipmap-xhdpi 
    set iconsize=96 
    if not exist "%subdir%" mkdir "%subdir%" 
    copy /Y %1 %subdir%\ic_launcher.png 
    %~dp0ResizeImage.exe %subdir%\ic_launcher.png %iconsize% %iconsize% 
    
    set subdir=%2\res\mipmap-hdpi 
    set iconsize=72 
    if not exist "%subdir%" mkdir "%subdir%" 
    copy /Y %1 %subdir%\ic_launcher.png 
    %~dp0ResizeImage.exe %subdir%\ic_launcher.png %iconsize% %iconsize% 
    
    set subdir=%2\res\mipmap-mdpi 
    set iconsize=48 
    if not exist "%subdir%" mkdir "%subdir%" 
    copy /Y %1 %subdir%\ic_launcher.png 
    %~dp0ResizeImage.exe %subdir%\ic_launcher.png %iconsize% %iconsize% 
    
    endlocal 
    

    c. Eseguire il file batch ogni volta che si aggiorna la vostra icona:

    ResizeAndroidLauncherImage.bat [YourIcon.png] [YourAndreoidSRCDir] 
    
  2. Utilizzare Android Asset Studio (https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html). Dovrai modificare l'origine per rimuovere il riempimento extra. Vedi https://github.com/romannurik/AndroidAssetStudio/issues/73 per una discussione su come farlo. Ho provato questo e utilizzato "none":

    const TARGET_RECTS_BY_SHAPE = { none: { x: 0, y: 0, w: 46, h: 46 }, circle: { x: 2, y: 2, w: 44, h: 44 }, square: { x: 5, y: 5, w: 38, h: 38 }, vrect: { x: 8, y: 2, w: 32, h: 44 }, hrect: { x: 2, y: 8, w: 44, h: 32 }, }; 
    

Se avessi Photoshop sulla mia macchina di sviluppo, vorrei anche provare:

  1. Registrare e riprodurre uno script batch in Photoshop. [Nota che non ho provato questo]
Problemi correlati