Page 1 of 1

Is pixel density support for android development? dp & sp vs px or %

Posted: Mon Aug 18, 2014 6:14 am
by deveu

I have designed my app using fixed width/height (px) in my images, cell, grid etc. and it looks the way I want for low density pixel devices (eg galaxy tab 1280x800 149 ppi)

Unfortunately when I test in an asus fonepad 9 (1280x800 216 ppi) medium pixel density it no longer shows correctly.

I don't want to edit html as I want to still be able to use appery interface to continue building.

I am building for landscape so do not want to use percentages as I'd rather is goes off screen in portrait then "compress" (I will use force landscape in the android manifesto).

As I'm only developing for Android; does appery support dp (for image) and sp (for font)?

http://developer.android.com/training...


Is pixel density support for android development? dp & sp vs px or %

Posted: Mon Aug 18, 2014 6:45 am
by Kateryna Grynko

Is pixel density support for android development? dp & sp vs px or %

Posted: Mon Aug 18, 2014 7:02 am
by deveu

Hi,

I'm not sure I understand how it works. Can you give me an example of what I would replace this css code with:

code
img {
width: 900px;
height: 800px;
}
/code


Is pixel density support for android development? dp & sp vs px or %

Posted: Mon Aug 18, 2014 10:16 am
by Kateryna Grynko

Hi,

You can set different element size depending on device pixel density:
http://www.w3.org/TR/css3-values/#res...