Import material design icons into an android project

前端 未结 5 641
野性不改
野性不改 2020-12-12 11:56

Is there an easy way to import all the icons of the Material Design icons repository into an android project with out the hazard of doing it manually?

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 11:58

    Here is a script that clones the github repository of the material design icons at

    https://github.com/google/material-design-icons

    and creates an index of all files. It also copies the svg files to subdirectories by category. You can use this as a basis to copy the files your are interested in into your project - just modify the find and cp copy statement to your liking. If you e.g. need the png's at a certain size - they are in neighbouring directories and you need to modify the find and copy command accordingly then.

    #!/bin/bash
    # WF 2016-06-04
    # get google material design icons
    # see http://stackoverflow.com/questions/28684759/import-material-design-icons-into-an-android-project
    tmp=/tmp/icons
    index=$tmp/index.html
    mkdir -p $tmp
    cd $tmp
    if [ ! -d material-design-icons ]
    then
      git clone https://github.com/google/material-design-icons
    fi
    cat << EOF > $index
    
      
        
        
          

    Google Material Design Icons

    EOF for icon in `find . -name *.svg | grep production | grep 48` do svg=`basename $icon .svg` category=`echo $icon | cut -f3 -d '/'` echo $category $svg.svg mkdir -p $tmp/$category cp $icon $tmp/$category echo " " >> $index done cat << EOF >> $index EOF

提交回复
热议问题