Creating a new Icon Set in Android Studio?

前端 未结 3 699
感动是毒
感动是毒 2021-01-07 17:23

In Eclipse there is File|New|Android Icon Set... How do I do the same in the Android Studio?

相关标签:
3条回答
  • 2021-01-07 18:03

    This isn't implemented yet in Android Studio; the bug to track it is at https://code.google.com/p/android/issues/detail?id=57062 . Others here have noted the links to web-based tools to edit icons. The icon generator in Eclipse ADT is actually ported from the same codebase, as is the icon editor in the new project/activity wizard in Android Studio, so the functionality is the same.

    0 讨论(0)
  • 2021-01-07 18:08

    The Asset Studio is integrated in Android Studio 0.4.0 and later. To create a new Android icon set, right click on a drawable folder and invoke "New > Image Asset".

    Via: Android Studio 0.4.0 Released

    0 讨论(0)
  • 2021-01-07 18:11

    I use an additional module in my Android Studio Projects to let Gradle generate the icon resources. To create icons, I use Inkscape. Setup: You have just to add an new module 'icons' to your Android Studio project, taken from GitHub. Then, define once the icons sizes in the my.properties file for mdpi:

    // All icon heights in dpi for drawable-mdpi
    actionbarIcon=32
    notificationIcon=30
    launcherIcon=40
    iconSmall=25
    iconMid=35
    iconBig=45
    

    For every new icon, add a property line to the config file 'icon.properties':

    // Icon with suffix         | SVG file with suffix      |size property          |module |flavor
    //--------------------------------------------------------------------------------------------------
    ic_action_export.png        |action_icon_export.svg     |actionbarIcon          |app    |main
    

    That's all. Now you can run the Gradle task :icons:generate. This task updates the resource files for every changed icon:

    app
      - main
        - res
          - drawable-hdpi
            - ic_action_export.png
          - drawable-mdpi
            - ic_action_export.png
          - drawable-xhdpi
            - ic_action_export.png
          - drawable-xxhdpi
            - ic_action_export.png      
          - drawable-xxxhdpi
            - ic_action_export.png  
    

    See my blog for a detailed description.

    0 讨论(0)
提交回复
热议问题