Context: I'm developing an Android application for tablets (landscape) with image resources which has a resolution of 1920x1200. That resolution fits on the following screen sizes and densities:
drawable-xlarge-hdpi
drawable-large-xhdpi
Problem: If I include all my image resources duplicated on this two folders the final size of the APK will be unnecessarily heavy
My unsuccessful approach: I tried to use Alias for this drawables as defined here: http://developer.android.com/guide/topics/resources/providing-resources.html#AliasResources
I have my image resource in:
res/drawable-nodpi/image_cmn.png
and the two alias inside corresponding screen sizes and densities folders:
res/drawable-xlarge-hdpi/image.xml
res/drawable-large-xhdpi/image.xml
image.xml:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/image_cmn" />
Of course, when I use my image inside a layout file I reference the alias:
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/image" />
But sadly Android is not resizing properly the resource for my testing tablet (mdpi) and the result is that I have bigger images.
I tried to move the original png's to res/drawable even to res/raw but result is the same than res/drawable-nodpi.
If I move this png's to res/drawable-xlarge-hdpi (same of xml alias) the result is correct but naturally that not solve my problem cause also I'd have to copy them to res/drawable-large-xhdpi and apk size increases.
Does anyone know how to achieve that?
res/drawable-sw600dp-hdpi/
. – Fromma-normal
devices running that resolution (or higher) later this year, for example. – Fromma