Search code examples
androidandroid-layoutandroid-screen-support

Supporting Screen Sizes - DP not working


I've developed an interface and everything has used dp settings so I thought it should have been good for most screen sizes. However when testing it gets messed up on most screen sizes, bigger and smaller. I get the icons not showing right since I only have one set for Nexus 4 size and density as they are only placeholders until I build the proper icons at the proper scales.

What is going wrong? Is dp the wrong way to go about designing it for scale? I've considered designing specific layouts for various screen sizes but I'm not sure where to begin in regards to what to target.

Here is what is should look like. (Nexus 4)

enter image description here

Smaller Screen (Nexus One)

enter image description here

Bigger Screen. (Nexus 5) - See how the text collides with the vertical divider.

enter image description here


Solution

  • dp - an abstract unit that is based on the physical density of the screen. which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use.

    It doesn't mean that image can scale automatically. It works in the specific density devices well.

    Generate ur icons with http://romannurik.github.io/AndroidAssetStudio/icons-generic.html and place the icons and check.

    For text don't use dp : instead use sp