0

One poster suggested using a project called SDP, as an answer to a question regarding the Android density independence mechanism. He justified it, saying:

It can help Android developers with supporting multiple screens

Why is that a bad answer or a bad idea in general?

Community
  • 1
  • 1
arekolek
  • 9,128
  • 3
  • 58
  • 79
  • why don't you post your answer there? – Viktor Yakunin Nov 25 '15 at 13:56
  • @ViktorYakunin I did post an answer to the question there. This is not an answer to that question. This is an answer to [a question posted by somebody else](http://stackoverflow.com/questions/33739945/putting-screen-densities-into-the-correct-bucket/33789580#comment55585031_33878046), in a comment to an answer to that question. It just wouldn't fit into a comment. – arekolek Nov 25 '15 at 13:59
  • Look, I see that guy doesn't understand basic principles, community supports you so he has downvotes. There is another answer which gives clear explanation and it is upvoted and accepted. Why do you want to convince him? – Viktor Yakunin Nov 25 '15 at 14:17
  • @ViktorYakunin I couldn't care less about convincing strangers on the internet about anything :) What I care about is explaining how Android works and how people should design for it. Which this post hopefully does. Reading through answers to that question left me with an impression that there's a general misunderstanding on this particular matter. – arekolek Nov 25 '15 at 14:26

1 Answers1

2

Multiple reasons:

Bad practice

The approach taken by this project is arguably useless, even destructive.

Destructive, because it breaks Android density independence. It takes images that need little scaling to match the display's actual pixels per inch property, because they were designed for that device's generalized density. And it scales them up, even up to 2.6 times on 10″ tablets. This must result in blurry or pixelated bitmaps.

Useless because:

You don't want bigger physical size on bigger devices in the first place anyway. You don't want to take an app and just scale everything on bigger screens. This is what Apple did when the iPad first came out in 2010 and people hated it.

What you do want is to put a limit on the width of text, buttons and other UI elements that shouldn't be stretched too much. You also want wider margins. But you handle this, by providing an alternative layout for large screens, not by fiddling with how Android handles the screen density. The documentation agrees with me on that.

And if you really wanted some graphic to be bigger on a large screen (which you generally shouldn't, the second image here is perfectly fine, except for the horizontal stretching), then you should handle it by providing drawables for every size/density pair that you want to support. For example drawable-hdpi, drawable-xhdpi, drawable-sw720dp-hdpi, drawable-sw720dp-xhdpi. This way the bitmap won't need scaling for those bigger screens and will be displayed in high quality.

Misleading

The screenshots do not use the same scale for each device. Nexus 7 looks just as tiny as Nexus One.

When the scale is preserved, the comparison looks like this when using the project:

The UI is physically bigger on Nexus 7 because it is scaled up.

And like this, when not using it:

The UI is physically the same size on both devices, because Android handles density independence and is not obstructed.

Irrelevant

That project deals with physical size and not screen density. What it does is scale units depending on varying physical screen size.

It does not apply to the question that was asked. Which could be paraphrased as "How does Android generalize an actual screen density?".

arekolek
  • 9,128
  • 3
  • 58
  • 79
  • arekolek, can I use your screenshots instead of mine and upload them to sdp github? I wanted to replace them a while ago but I didn't find the time to create new screnshots... – Elhanan Mishraky Dec 21 '15 at 12:18
  • @ElhananMishraky those are indeed screenshots from github, just edited to account for physical scale between devices, you are free to use them as you like. – arekolek Dec 21 '15 at 21:17