This question is without question, and I apologize to everyone who found it, hoping that the accepted answer will be what they are looking for when it does not.
To make it clear, scaleType=centerInside
works as expected. That is, if you have an image smaller than the ImageView
itself than this image will not scale to the borders of the ImageView
, it will remain in the center and unscaled.
But in order for the above to work as expected, the nodpi
must be placed in the nodpi
folder. I understand that this is not always acceptable. Therefore, when this drawable should be placed in one of the density folders instead of the nodpi
folder, the scaleType
attribute will only work in certain situations.
When it will work:
- You use the application on a device / emulator with an
Xdpi
density and in the Xdpi
density Xdpi
there is the possibility of drawing (here X
means l
, m
, h
or even xh
). - You have launched an application / application emulator, for example, with
hdpi
density, but in hdpi
, and the system selects an alternative that can be extracted from nodpi
(it is not always known which folder it will choose from).
When this does not work:
- You have launched the application / application emulator, for example, using
hdpi
density, but there is no picture in the hdpi
folder, and the system selects an alternative to be extracted from any other folder density (not the nodpi
folder), then the nodpi
one will be scaled to ImageView
, and the scaleType
attribute scaleType
not there will be something.
In conclusion, there is no “right” answer to my question, it really depends on what you are trying to achieve. The answer to my question, though, I just need to do 2 things: a) Set ImageView
scaleType
to centerInside
and b) Duplicate all the drawings from the mdpi
folder to the hdpi
folder (as described above, scaleType=centerInside
will make it work).
Of course, duplicating the drawings is not optimal, but I can’t find another solution, and so far no one else could ... So, at present I will mark this as accepted.
What would be the best answer / solution?
In my opinion, if the device / emulator works in hdpi
, and there is no suitable picture in the hdpi
folder, it should choose to extract from the mdpi
folder without scaling, which allows the scaleType
attribute to do this. Or, perhaps, make the system go to the nodpi
folder if it does not find a suitable upload in the corresponding density folder, which can also help.
So, if anyone can ever provide a workaround / fix for this problem, this will be the correct correct answer. If it ever comes to this, I will change the accepted status.