In my application i have to support 540x960 screens.
I have created a directory named: drawable-540x960
for containing all graphics items for this screen.
But i
I have tried with different emulators...Finally i succeeded.Height should be first value.
res/layout-long-port-hdpi-500x300/layout.xml (For testing i created this emulator)
res/layout-long-port-hdpi-960x540/layout.xml (For Motorola Droid Razr, Motorola Droid Bionic, etc)
res/layout-long-port-hdpi-800x480/layout.xml (For Nexus)
Actually you are giving wrong directory name for your screen .you can refer this from developer site go here https://developer.android.com/guide/practices/screens_support.html#NewQualifiers
in that site See Table No :2 for qualifers for screen size
also one line you can find in that is :
If the available height is a concern for you, then you can do the same using the h<N>dp qualifier. Or, even combine the w<N>dp and h<N>dp qualifiers if you need to be really specific.
For Specify use of Screen Size 540x960 ,you need to add layout like below and it is valid way to define width and height used for that xml layout.
res/layout-w540dp-h960dp/any layout which you need put in side this folder
I am sorry to say but s.krueger's solution will not work if you have some other drawable like drawable-mdpi or drawablae-xhdpi or drawable-xxhdpi or drawable-hdpi. It won't take the drawable-hdpi-960x540.
You have to name the drawable as per your pixel density and the screen size. The calculation is here...
dpi = sqrt (540^2+960^2) / 4.3"(Device size) = ~256 dp = px / (dpi / 160) = 540 / (dpi / 160) = 330
The drawable will be named as drawable-sw330dp. I have tested this. And this works good. No problem with other drawables either. Layout Will be layout-sw330dp
Or you can try this by drawable-sw540p. I haven't tested it yet. But I guess it will work good. Layout Will be layout-sw540p
Well actually the answer is quite simple:
drawable-hdpi-960x540
1) You have to specify the density 2) You have to name the height first
Android didnt recognize drawable-540x960 because it is an invalid size qualifier
You might want to look at android's guideline on supporting different screens http://developer.android.com/guide/practices/screens_support.html#NewQualifiers
Here are some examples valid identifiers
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)