Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast ways to import drawables in Android Studio?

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 times you have images scaled for the most common qualifiers (drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi, ...).

So we need to do three, four, even five file copy/pastes for each drawable:

external_dir/drawable-mdpi/file.png   ->  my_package/drawable-mdpi/file.png external_dir/drawable-hdpi/file.png   ->  my_package/drawable-hdpi/file.png external_dir/drawable-xdpi/file.png   ->  my_package/drawable-xdpi/file.png external_dir/drawable-xxdpi/file.png  ->  my_package/drawable-xxdpi/file.png 

That is annoying if you have to import multiple pics. Is there an easy, quick way to transfer these four instances of file.png right in the corresponding package folder? Some function implemented in the IDE? Some easy workaround?

My workflow until now has been:

  • copy/paste from OS file manager, from the external directory to the package, and then refresh the resource files in Android Studio. That implies opening each one of the qualified subdirectories, so four moves;
  • from the OS file manager, move to external_dir, search for file.png, get the four instances in a single list, drag&drop into Android Studio, then for each pic right click on the nav bar, Copy, and Paste in the corresponding package directory. Not really better!

Any advice?

Edit - I'm not really asking for "advices" of course - I want to know if there's a way to drop the number of moves to one (or such).

like image 994
natario Avatar asked Feb 13 '15 15:02

natario


People also ask

How to import drawables in android studio?

Drag and drop your images directly onto the Resource Manager window in Android Studio. Alternatively, you can click the plus icon (+), choose Import Drawables, as shown in figure 3, and then select the files and folders that you want to import. Figure 3: Select Import Drawables from the dropdown menu.


2 Answers

Check android-drawable-importer-intellij-plugin

like image 158
Cool Avatar answered Sep 19 '22 13:09

Cool


This became a lot easier since Android Studio 3.4. Simply go to the Resource Manager-tab and click the little add-button add resources to the module. [add button within resource manager[1]

Then select the drawables you would like to import. If you placed the drawables in folders with the same name like the qualifiers (drawable-mdpi, drawable-hdpi. drawable-xhdpi and so on), the tool will automatically know were to add them. drawables import dialog

The only thing still missing in my opinion is adding the drawables to a certain flavorDimension.

like image 35
Wirling Avatar answered Sep 20 '22 13:09

Wirling