2014-04-29 5 views
6

enter image description hereएंड्रॉयड स्टूडियो ic_launcher.png

enter image description here

मैं शुरुआत एंड्रॉयड डेवलपर हूं आइकन के गद्दी जोड़ें। मैं यह नहीं समझ सकता कि एएस स्वचालित रूप से मेरी पीएनजी फ़ाइल में पैडिंग क्यों जोड़ता है। मैंने res-new-image एसेट के माध्यम से पीएनजी फ़ाइल जोड़ा- एंड्रॉइड ऐप आइकन के लिए मेरी पीएनजी फ़ाइल जोड़ें। फ़ाइल में पैडिंग नहीं है।

उत्तर

1

इस पर क्लिक करके, मुझे आशा है कि यह मदद मिलेगी;) enter image description here

+0

यह मेरे लिए काम नहीं करता – PowerMan2015

1

मैं अतिरिक्त गद्दी कि एंड्रॉयड स्टूडियो जब माउस बनाने कहते हैं चारों ओर पाने के लिए दो समाधान पाया:

  1. छवियों का आकार बदलें का उपयोग कर एक [ विंडोज़] बैच फ़ाइल। यह वह है जिसका मैं उपयोग करता हूं क्योंकि यह मेरे लिए सबसे आसान है (विंडोज़ पर):

    ए। http://www.ianmcintyre.com/2014/06/c-resize-image-fit-image.html

    बी से सरल कोड का उपयोग करके ResizeImage.exe बनाएं। ResizeImage.exe के समान निर्देशिका में निम्न ResizeAndroidLauncherImage.bat फ़ाइल को सहेजें। यह आपकी मूल छवि को विभिन्न निर्देशिकाओं में प्रतिलिपि बनाता है और उनका आकार बदलता है:

    @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 
    

    सी। बैच फ़ाइल हर बार निष्पादित आप अपने आइकन अद्यतन:

    ResizeAndroidLauncherImage.bat [YourIcon.png] [YourAndreoidSRCDir] 
    
  2. एंड्रॉयड एसेट स्टूडियो (https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html) का प्रयोग करें। अतिरिक्त पैडिंग को हटाने के लिए आपको स्रोत को संशोधित करना होगा। इसे कैसे करें इस पर चर्चा के लिए https://github.com/romannurik/AndroidAssetStudio/issues/73 देखें। मैं इस और प्रयोग किया जाता "कोई नहीं" करने की कोशिश की:

    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 }, }; 
    

अगर मैं अपने विकास मशीन पर फ़ोटोशॉप था, मैं भी कोशिश करेंगे:

  1. रिकॉर्ड और प्लेबैक फ़ोटोशॉप में एक बैच स्क्रिप्ट। [ध्यान दें कि मैंने यह कोशिश नहीं की]
संबंधित मुद्दे