Fast ways to import drawables in Android Studio?

前端 未结 14 2142
北荒
北荒 2020-11-28 07:10

At some point in an Android project you will need to import some drawables - be it toolbar icons, images, UI features - in res/drawable directory. Most of the t

相关标签:
14条回答
  • 2020-11-28 07:54

    Simplest and Fastest way is just copy paste all in one shot only if you have image in already formatted folder as mentioned below.

    • Download any image from Meterial Icons here

    • Downloaded folder contains all levels of drawable folders (mdpi, hdpi, ect..)

    • Just copy all the folders and paste it to res folder, Here the folder is not replacing just the new image will going to add existing image.

    0 讨论(0)
  • 2020-11-28 07:57

    In your Android Studio, Right click drawable -> New -> Image Asset -> Asset Type: Action Bar and Tab Icons. Image file: image_path, Resource Name: image name -> Next -> Finish

    Done

    This will add 4 different sizes of your image so that it will fit depending the device size

    0 讨论(0)
  • 2020-11-28 07:59

    I usually do it in a very simple way: I use this tool to generate my images directly in the right folders names: you just have to open the tool and drag on it the bigger image (EG: the one you want to use for xhdpi folder or xxhdpi folder): the tool will create in the original image's folder all the other folders (mdpi,ldpi,hdpi etc) containing the image properly scaled. Once you have this folders you just have to paste them in res folder, DONE!

    0 讨论(0)
  • 2020-11-28 07:59
    1. Select the "res" directory
    2. Right click and select "Compare with"
    3. Find the directory where your drawables are coming from
    4. Hide outgoing changes
    5. Select all the incoming changes and click the arrow to synchronize.
    0 讨论(0)
  • 2020-11-28 08:00

    From Android studio -> Goto Configure->plugins. Search for "Batch Drawable importer" . Click Install. Then restart android studio.

    0 讨论(0)
  • 2020-11-28 08:03

    It seem the way to do it is drag and dropping the resources to AS. For instance. We have a bunch of images, we grab all the xxhdpi images drop them in AS and then it will ask you which resolution are those images, so we choose from the pouup xxhdpi.. then, all the images in xhdpi drop again choose xhdpi from pop up, and that's the way to import assets to A.S. and so on with each resolution.

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