Vocab
px
Pixels – corresponds to actual pixels on the screen.
in
Inches – based on the physical size of the screen.
mm
Millimeters – based on the physical size of the screen.
pt
Points – 1/72 of an inch based on the physical size of the screen.
dp
Density-independent Pixels – an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both “dip” and “dp”, though “dp” is more consistent with “sp”.
sp
Scale-independent Pixels – this is like the dp unit, but it is also scaled by the user’s font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user’s preference.
NOTE: comments can’t be insterted between tags
Strings
Every text displayed should be wrapped into a string for packaging sake. The program gets a little piffy (note the caution icon–yellow triangle– on “large text”) when you try to “hardcode” text. So, day one of coding my new app, Calcu, is making strings so the buttons have something legit to display. A big learning moment was installing the Obelus (the division symbol– yeah I didn’t know the name of it either!). Using a character map to find the unicode, I was able to reference this particular character with “÷.” Very exciting.



Text Alignment
I aligned the zero in the text box with gravity. Android:gravity=”top|right” different from html. I like it. I imagine a magic gravity wand drawing all text into that part of the box. It’s not a matter of alignment. It’s forces of nature at work!
Links for symbols:
Unicode and HTML – Wikipedia, the free encyclopedia
List of XML and HTML character entity references – Wikipedia, the free encyclopedia.
[…] I stepped back into code land. With my layout complete from my last session, I started on methods so the buttons would actually do something when clicked. Note: in the […]