1

Today, I read the android tutorial about supporting multiple screen. I got some problems here. In the tutorial, it says we can use size and density-specific resource in this way:

res/layout-w600dp/main_activity.xml

I know that w600dp means the available width is 600dp. But is it for portal or landscape?

Here is real case: I want to design a full width header image for my android app in portal mode. This app is targeted for Samsung Galaxy S4, which has 5.0 inches, 1080x1920 pixels with 441 dpi. That means my header image need to be 1080 pixels. As android tutorial mentioned, in android, px = dp * (dpi/160); In Samsung Galaxy S4 example, 1080px width is 391dp. So do I need to declare the layout in:

res/layout-w391dp/main_activity.xml

or

res/layout-w320dp/main_activity.xml

When I am using Photoshop to create my header image, do I need to set my image parameter as 1080 width, 40 height and 441dpi? After I get the image, do I need to put this image in:

res/drawable-xhdpi/

or

res/drawable-w600dp/

James
  • 5,119
  • 5
  • 25
  • 27

1 Answers1

0

The available width value will change when the orientation changes between landscape and portrait to match the current actual width.

If you want provide different layouts/resources for landscape and portrait add the qualifier name -land or -port respectively. See more at Android documentation

If you want fill all the available width don't think about dpi. If device width is 1080px then you need an image with 1080px. However, if you want an image look the same at diferent devices with diferent density then calculate its dimensions by applying these factors:

ldpi = 0.75
mdpi = 1
hdpi = 1.5
xhdpi = 2
xxhdpi = 3

It is not possible here to do a full explanation on this subject, and my English is not enough for such.

ramaral
  • 6,149
  • 4
  • 34
  • 57
  • How about another 3 questions? I already ready the Android documentation. But for a real case, I am still not sure how to use. – James Oct 20 '13 at 15:20