mark-friedman / app-inventor

Automatically exported from code.google.com/p/app-inventor
0 stars 0 forks source link

make notifier font look better on old phones #300

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The new notifier font is too large on old phones. Can we detect the density and 
change the font to look good on all screen sizes?

Original issue reported on code.google.com by halabel...@google.com on 2 Dec 2012 at 10:11

GoogleCodeExporter commented 9 years ago
See if this helps

 getResources().getDisplayMetrics().density;

This will give you:

0.75 - ldpi
1.0 - mdpi
1.5 - hdpi
2.0 - xhdpi
3.0 - xxdpi

Original comment by halabel...@google.com on 2 Dec 2012 at 10:18

GoogleCodeExporter commented 9 years ago
Or, we can try this as well.

Instead of using setTextSize(20), we use this:

setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);

This should have android automatically scale the text size depending on density.

Original comment by IMPINC...@gmail.com on 2 Dec 2012 at 10:34

GoogleCodeExporter commented 9 years ago
The UNIT_SP method didn't work, and I can't manage to make this work with 
DISPLAY_METRICS.   I did it by checking the build level.  This is certainly not 
the
right thing in the long run, but it seems to work for now.

Original comment by halatmit...@gmail.com on 3 Dec 2012 at 4:11

GoogleCodeExporter commented 9 years ago

Original comment by halatmit...@gmail.com on 4 Dec 2012 at 2:25

GoogleCodeExporter commented 9 years ago

Original comment by halatmit...@gmail.com on 15 Dec 2012 at 3:12