4

I start developing a new Android application from scratch these days. The company I work for has its own designer.

The designer asked me for the sizes of screens she should design for and I didn't know what to tell her - I want to support all the Android based smartphones with all the different densities and screen sizes.

I'm familiar with this doc about supprting multiple screens.

Question #1: So, can I assume that all the smartphones are "normal" screen size, and look at "Table 3" at the bottom of link I've added, at the "Normal screens" row and tell the designer that I need 4 versions of each page, as listed in this row: WQVGA400 (240x400), HVGA (320x480), WVGA800 (480x800) , 640x960 ? Will these resolutions cover all the Android based smartphones?

Question #2: While working on the project, the designer might tell me:"the title bar should be 40px long in the 240x400 screen", how can I translate these pixels into dip's? How can I achieve easy daily work when it comes to working with the designer? Should I just develop first only for mdpi, on 320x480 screen where 1 pixel = 1 dip and then no translation is needed?

Thanks in advance!

ofirbt
  • 1,846
  • 7
  • 26
  • 41
  • For 2nd Question, check this: http://stackoverflow.com/a/2025541/379693 – Paresh Mayani Feb 07 '12 at 10:44
  • You can design graphics for smaller size and use it for larger ones if you use 9-patch images.That can easily be stretched! – Hiral Vadodaria Feb 07 '12 at 10:52
  • @Hiral - This is good for certain uses, such as buttons background and stuff like that, but for daily working with the designer I need to cover all the possibilities... – ofirbt Feb 07 '12 at 11:26
  • Yeh..Thats right! but thats really good even for title background and all.Try it out! :) – Hiral Vadodaria Feb 07 '12 at 11:45
  • @Paresh Mayani - I know how to translate px to dpi and viceversa, but I would like to avoid this - it doesn't make any sense to use formulas for every tiny change in the UI... – ofirbt Feb 07 '12 at 12:10
  • Amazing... 51 views and no real answer... Apparently Android's UI is just pain in the ass, if one really wants to do it right. Yeah, I could just go on and forth telling the designer "Hi, I need the thumbs_up.png to be 4 pixels smaller" and such, or translate the padding pixels to dp, and then check on different devices and probably do some other fixes, but it's really not efficient. Maybe Google just not there yet... – ofirbt Feb 07 '12 at 13:20
  • @ofirbt You can scale an image at runtime. No need to have the exact size for EVERY device. I usually use proportional scaling (i.e: an image in a ListView should have 30% wide) – Mister Smith Feb 07 '12 at 14:11
  • @Mister Smith - That would be true if we would use `android:background` of the `ImageView` which actually scales the image, but everyone keeps telling that you should use `android:src`, which does NOT scale the image... So even if your `LinearLayout` will have 30% of the parent, the image itself still occupies the its actual size... (right?) – ofirbt Feb 07 '12 at 14:32
  • @ofirbt no. You can have parent layouts, where you adjust the max size for the child image with `android:layout_weight`. Then you place inside an `ImageView` with `fill_parent` in both height and width. Then you define the attribute `android:scaleType` for your ImageView, and either use src or programmatically set an image at runtime. – Mister Smith Feb 07 '12 at 16:12

5 Answers5

3

The new Android Design Guide should give you all information you need.

The transformation between dip and px is based on the type of dpi you have and not on the screen size. Define your own title bar to make sure, that the height is the specified one.

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
2
  1. No You should say designer that it's most common values, but not all possible. So, try to get design with comments "1/5 of phone screen and 1/10 for tablet screen" not "40px". Other possible way - to create design for only resolution, and then stretch it to other screens.

  2. This question gives good answer

Community
  • 1
  • 1
Jin35
  • 8,602
  • 3
  • 32
  • 52
0

The answer for the question 1 is no. For instance, Galaxy Nexus has a resolution 1280x720, Droid Razr 960×540.

Yury
  • 20,618
  • 7
  • 58
  • 86
0

ANSWER #1: No

ANSWER #2: Have a look at this link to understand a bit more about dip.

Mister Smith
  • 27,417
  • 21
  • 110
  • 193
  • So, what is the answer to this question(number 1)? – ofirbt Feb 07 '12 at 10:27
  • You can target most common sizes in the market and provide custom resources for them, but you cannot address all the devices in this manner. Since it is up to the manufacturer, there are always going to be odd screen sizes. – Mister Smith Feb 07 '12 at 13:44
  • OK, that makes sense, but what resolutions should I use? I don't want to take 2 resolutions that might end up in the same density bucket... – ofirbt Feb 07 '12 at 13:58
  • Usually you use resolution for Views and density for bitmaps. What I use is percentages for Views and density to define a set of graphics (jpgs, pngs), so that I always have a reference (and enough sized) image to downscale to the exact bitmap size. Most artifacts in images appear when upscaling, downscaling from an original image which is larger than the desired size usually yields acceptable results. – Mister Smith Feb 07 '12 at 14:33
  • I mean in the app. ImageViews do offer this and can be configured in the layout xml. Bitmaps also allow scaling on runtime (this time you have to code though). – Mister Smith Feb 07 '12 at 16:00
  • That would be true if we would use android:background of the ImageView which actually scales the image, but everyone keeps telling that you should use android:src, which does NOT scale the image... (right?) – ofirbt Feb 07 '12 at 16:10
0

I think the iPhone way of doing things doesn't quite work on Android (Limited iPhone experience here but you pretty much have set graphics for everything right?) on Android the designer will probably have to get familiar with the layout system or somebody else would need to take a reference design and translate it into a layout file.

mbwasi
  • 3,612
  • 3
  • 30
  • 36