Issue
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 forfile.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
, andPaste
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).
Solution
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
.
[
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.
The only thing still missing in my opinion is adding the drawables to a certain flavorDimension.
Answered By - Wirling
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.