views:

184

answers:

2

A user of my Android App reported that he was seeing tiny text. How is this possible? More importantly, how can I use the emulator to be sure that my changes will fix it?

Background:

This user has a Motorola DROID phone, which has a different screen resolution and maybe other slight differences.

I assume that the problem was I didn't test using the right screen size. However, I followed the instructions here and tested a larger screen and the text was fine. http://developer.motorola.com/docstools/library/Support%5Ffor%5FMultiple%5FScreen%5FResolutions/

I know my app has fixed pixel heights like this: android:layout_height="64px" and I use text side parameters like: android:textSize="14sp" or android:textSize="12pt"

+3  A: 

There is a bug in the DROID where screen density is being reported incorrectly, causing the DROID to mis-calculate pt, mm, and in dimensions. This is a DROID-specific problem, so the emulator will not demonstrate it.

While, long-term, using pt or mm is a very good idea, tactically, work out a reasonable size in px (test that in the emulator) and you should be OK.

I suspect this will be fixed in the patch release that is rumored for later this year.

CommonsWare
I'm still not sure what you are suggesting.Given this bug, how should I set text size? Should I use textSize="14sp" or textSize="14pt"?
gregm
14sp has a greater chance of working in the near term.
CommonsWare
I find that dp for all values works very well, but the font size needs to be bigger, at least 16 dp. Regards, Ari
BeMeCollective
I did a bit more digging, and it looks like the pixel density scaling factor is correctly being reported as 1.5. Screen dimensions are correctly reported as 480x854. What is not correct is xDPI of 96 and yDPI of 96.I don't quite understand why this hasn't affected practically every app on the Market. Why aren't devs screaming about this? Has everyone come silently to the same decision to use pixel values? I'm porting an iPhone app to Android and I want to ensure that the font is the same size, and now I'm going to be forced to do those calculations on my own rather than trusting the OS.
Neil Traft
The original problem that I reported in my answer was fixed with Android 2.0.1, AFAIK.
CommonsWare
A: 

The Problem is not Droid itself. The problem is the screen resolution. In the emulator i have the same problem with a big resolution.

I think the problem is android itself.

chrisonline