There are two possible answers to your question. The first, and to which anyone would answer, is that the @Ramaral quoted.
In quotation to his comment, I will summarize it as a response. You will have to create two images, with the same name, but with appropriate resolutions to lang
and port
. To do this, set your /res
should look like this:
Drawable-land
imagem.png
Drawable-port
imagem.png
There is a problem when performing such configuration: you would need to keep creating two images for each type of resolution, which is somewhat harmful.
The second answer is the simplest and most compact. You create only one image and use it at any resolution because the image is auto resizable.
The answer comes from a question I asked myself: When and why we should use SVG?
If we use SVG
, create just one file and use it in different resolutions, without it losing quality. Follows the answer:
I learned how to vector "things" in Corel Draw, and this image business is not losing quality. (blabla)
From the Lollipop (API 21), Android included the class VectorDrawable
, to define drawables based on vector graphics. The Android Studio 1.4 adds the Vector Asset Studio to make them easier to work with, including an SVG import feature and a new Gradle plugin that generates PNG versions of icons VectorDrawable
at build time for API 20 and earlier versions. There are also third party tools to convert Svgs to VectorDrawables
. Keep in mind that although the vector drawables can be set in XML, the file format is not SVG and not all SVG files can be converted successfully.
It is recommended to start a transition from PNG to SVG in the application?
According to the documentation, the use of vector characters instead of bitmaps reduces APK size because the same file can be resized to different screen densities without loss of image quality.
We have that each library added to a project brings many possibilities and features, but libraries usually contain a lot of code files and resources, among them, unnecessary resources depending on each type of situation. This creates a kind of residue: apps have a lot of things that are never really used. More than that, the size of the packages are growing at a fast pace. The point is, we should try to decrease as much as possible
This image found on Wikipedia that better defines the Scalable Vector Graphics, illustrates the difference between bitmap and vector images. The bitmap image is composed of a fixed set of pixels, while the vector image is composed of a fixed set of shapes. In the image, the bitmap scale reveals the pixels when resizing the vector image preserves the shapes.
Read the documentation for more details.
Yes, it is possible. See documentation as.
– ramaral