I'm trying to import a 600x600 PNG I made into my Android project so that I can use it as a full-sized image in an Activity. Dragging and dropping it onto my /res folder just puts it in that folder, which of course generates an "invalid resource directory name" error. I can drop it into any of the /res/drawable folders and that works fine, except then it's only in that one folder. Surely, there's an inbuilt tool which can take my image and scale it appropriately for each /res/drawable folder.
问题:
回答1:
AFAIK there isn't.
What you can do though, is use the drawable-xhdpi
folder only. Android will automatically scale down for lower dpi.
The only exception is the launcher icon. You will have to provide all sizes (don't forget xxhdpi for tablets!).
You can find the needed sizes in the Icon Design Guidelines.
It is important to note that the ADT plugin does have tools for generating some icons sets, such as Launcher icons, Actionbar icons and Notification icons.
These tools can be accessed by opening the New wizard (Ctrl + N) and double-clicking Android Icon Set in the Android category.
回答2:
there's an inbuilt tool which can take my image and scale it appropriately for each /res/drawable folder.
For the scaling part, check out the Icon Generators Tools @ Android Asset Studio. There are tools for generating Launcher icons, Tab icons, Action bar icons and (in your case) Generic icons.
回答3:
Luckily this changed - you are now able to autogenerate different densities - take a look at: https://code.google.com/p/android-drawable-converter/
回答4:
If you put your drawable resources in /res/drawable, that resource will be used for all devices.
However, it probably won't do exactly what you want. I would recommend scaling the assets yourself. If that isn't a viable option, then you are stuck with letting Android do the scaling for you.