6
votes

Following folder structure is working fine for the mentioned devices and resolutions:

  • drawable-hdpi -- for 480x800
  • drawable-ldpi -- empty
  • drawable-mdpi -- for 320x480 and 240x320 (mdpi device)
  • drawable-sw600dp-tvdpi -- for Nexus 7 2012 tvdpi
  • drawable-sw600dp-xhdpi -- for Nexus 7 2013 xhdpi

The problem is with the Nexus 10 and Samsung Galaxy Tab 10 (Tab is with Android 4.0 & mdpi). To handle both devices I added two separate drawable folders:

  • drawable-sw800dp-xhdpi -- for Nexus 10 (put 2560x1600 resolution images to this folder)
  • drawable-sw800dp-mdpi -- for Samsung Galaxy Tab 10 (put 1280x800 resolution images to this folder)

However, both Nexus 10 and Samsung Galaxy Tab 10 are using images from drawable-sw800dp-xhdpi.

What else did I try?

  • drawable-sw720dp-xhdpi -- for Nexus 10
  • drawable-sw720dp-mdpi -- for Samsung Galaxy Tab 10

Similar result, both Nexus 10 and Samsung Galaxy Tab 10 are using images from drawable-sw720dp-xhdpi.

I also tried to use drawable-xlarge-mdpi and drawable-xlarge-xhdpi (removed drawable-sw800dp-mdpi & drawable-sw800dp-xhdpi) to handle Samsung Galaxy Tab 10 but Tab is with Android 4.0 and xlarge structure is deprecated. So it is taking according to the new directory structure (i.e., drawable-sw600dp-xhdpi).

Other related stuff

In Eclipse graphical layout editor correct images (from drawable-sw800dp-mdpi) are shown after selecting 10.1" WXGA (Tablet) which is like Samsung Galaxy Tab 10. However, when I test the same thing in device or emulator it is showing images from drawable-sw800dp-xhdpi.

Manifrest:

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

Layout:

layout

values:

values
values-sw320dp
values-sw600dp
values-sw800dp
  • Separate drawable folder is required because some of the images can not be converted into 9 patch images.
  • Please my question is not about conflicts between nexus 7 and nexus 10 or not between Samsung Galaxy Tab 7' and Samsung Galaxy Tab 10'.

The question

So what should be the drawable folders for Nexus 10 and Samsung Galaxy Tab 10?

7
Both of them are xhdpi. Why do you have all-caps text at the end?corsair992
@corsair992 both are not xhdpi. samsung 10 inch tab is with mdpi .. please check this gsmarena.com/samsung_galaxy_tab_2_10_1_p5100-4567.php even by code if we gt m gttng MDPI.. why last text are in caps ? bcz jst to mentioned things ... why is there any prob with that .. thn pls let me know i will make those to small...if any problem with current format ....user1140237
Don't use all-caps in normal text. It's the equivalent of shouting in writing. Don't use txt-speak either, as that makes it harder to read. Just use normal English and formatting. As for the problem, I have no idea then, sorry. I was looking at the Pro version.corsair992
Okay thanks a lot :) .. Pls provide the link or smthng where I can learns this type of things.. Means knowledge what u have where I read or gain that.. It will b helpful to me.. Np if u dnt have any answer for this question...user1140237

7 Answers

8
votes

You can use drawable folders in this format:

drawable-480x320
drawable-1280x800
drawable-2560x1600
...

etc

2
votes

To solve the problem of mdpi tablet load the resource inf "drawable-sw720dp-xhdpi", use this way:

The drawable names "R.drawable.ic_xxx";

drawable-xhdpi put your Nexus 10 pic, named as ic_xxx_720.png;

drawable-mdpi put your Samsung Galaxy Tab 10 pic, named as ic_xxx_720.png;

then in values-sw720dp put resource alias:

<item name="ic_xxx" type="drawable">ic_xxx_720.png</item>
1
votes

If you are using Android studio, you can right-click resource folder New-> Android resource folder.You will see all available conditions for drawable folders, including screen size.Also you can choose multiply conditons. Probably same will for Eclipse, but i hadnt tested this.

0
votes

One thing that might work is using a different smallest width (assuming they are different for the 10" and 10.1" device).

To do this, use an app to get the exact smallest width, for instance: https://play.google.com/store/apps/details?id=com.jotabout.screeninfo

If they are different, you can simply use them as the -swxxxdp qualifier.

Note that the smallest width qualifier doesn't need to be a round number, it can be anything: sw800dp, sw801dp, sw802dp,...

0
votes

You have to Clean the project after renaming the resource folders, otherwise the R object will not be regenerated which will make your app use the old references.

Something like you have done here goes in the correct direction :

I also tried to use drawable-xlarge-mdpi and drawable-xlarge-xhdpi (removed drawable-sw800dp-mhdpi & drawable-sw800dp-xhdpi)

(I hope you haven't spelled it "mhdpi" like you have done in your post though)

0
votes

A set of six generalized densities: ldpi (low) ~120dpi mdpi (medium) ~160dpi hdpi (high) ~240dpi xhdpi (extra-high) ~320dpi xxhdpi (extra-extra-high) ~480dpi xxxhdpi (extra-extra-extra-high) ~640dpi

And

xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp

Please refer

http://developer.android.com/guide/practices/screens_support.html

0
votes

Try to use Configuration qualifiers for your resources drawable folder for tablet version.

drawable-sw600dp (for 7" devices)
drawable-sw720dp (for 10" devices)
drawable-sw600dp-land (for 7" devices with landscape mode) drawable-sw720dp-land (for 10" devices with landscape mode)