0

I design my UI with Density-independent pixel as units of measurement.

I have same icons 18x18 dip. What should be the phisical dimension of the png icons for ldpi, mdpi and hdpi? I try 9x9, 12x12 and 18x18 but the emulator enlarge them.

kristby
  • 81
  • 2
  • 7

1 Answers1

2

Try this answer. Dips are equivalent to pixels at 160 dpi. Anything else, just scale it.

Community
  • 1
  • 1
Geobits
  • 22,218
  • 6
  • 59
  • 103
  • Yes I read official documentation, at 160 dpi 1 dip = 1 px, at 240 dpi 1 dip = 1,5 px. It is ok. My problem is that i I draw an icon 18x18 px and I define it 18x18 dip, on 240 dpi my icon is enlarged on screen to 27x27px with bad graphical result. My question is, there is a physical raccomandend proportion between px and dip to avoid it? – kristby May 31 '11 at 08:11
  • Yes. In both the link I gave and the official docs, it says to use px = dip * (dpi / 160). That fits your example perfectly, as in 27 = 18 * (240 / 160) Unless I'm misunderstanding the question, that's the answer you're looking for. – Geobits May 31 '11 at 08:38
  • Yes, I made confusion with ldpi, mdpi and hdpi dimension :-) so 18 dip is 12pixel in ldpi, 18pixel in mdpi and 24 pixel in hdpi, perfect thanks – kristby May 31 '11 at 08:50