1

I would like to support many different screen types with the drawable resources. But I can use some drawables with the same size on more screens.

For example: -xxhdpi-normal and -mdpi-xlarge could use the same sized drawable image I don't wan't to make 2 folders (drawables-xxhdpi-normal and drawables-mdpi-xlarge), because then the .apk will be bigger.

I know that if I just put simply every drawable resource into drawables folder with different names. Then I can make the layout for every screen. It is a lot of work but makes a smaller .apk I know that it is easier to maintaine my code if I use refs.xml instead of the differnet layout.xml-s (about refs.xml: http://blog.vogella.com/2013/08/13/using-xml-layout-references-in-android/)

 <?xml version="1.0" encoding="utf-8"?>
<resources>
    <item type="layout" name="activity_main">@layout/activity_second</item>
</resources>

But in this case I will still have a lot of work with the resource naming, and I can't use tools like (cut and slice me - photoshop plug-in that exports drawables for different dpi-s)

Is there a way, I can just say to the system: If the device is -mdpi-xlarge use the drawables-xxdpi folder to make the layout?

Tomi
  • 3,370
  • 1
  • 16
  • 26
  • The system already does this in background. It you have an mdpi screen and only have an image with that key in xxhdpi then it will downscale that image. If you don't want any scaling, you can use the default drawable folder (I highly discourage you to do so!) – Tobrun Dec 10 '14 at 20:04
  • I know how it works. But there is a reason why I want this way. The reason is: I want a picture ABOUT 90% width of the screen width. A tablet should use the xxdpi res - because that has enough pixels to fill the 90% of the screen without too much resizing. I don't like how the system resize something (no aliashing) I use ~90% so, I just put the picture on the screen pixel to pixel - so no resizing – Tomi Dec 10 '14 at 22:07

1 Answers1

1

the system use automatically the resource folder (when avalable) closest to your resolution or one scale and appear best

for example

if you use only xxxxdpi it will alway down scale them , so single folder and quite decent image quality

if you want to use different assets for some resolutions just override that files in that folder

miv
  • 339
  • 4
  • 7
  • 1
    I know how the system works. There is a special reason why I want this tricky way. My question was about making own reference – Tomi Dec 10 '14 at 22:22