when I was playing around with listviews I noticed that a 85dips high layout loaded in a 85dips high listview item didn't fit
Note that the coordinate system and the pixel row/column numbering are two different things. For the top-left pixel on the screen, ie row 0 col 0, the edge coordinates of that pixel are:
- top edge: y = 0
- bottom edge: y = 1
- left edge: x = 0
- right edge: x = 1
and so if you specify a rect of (5, 7, 11, 17) which:
(i) if those numbers were pixel addresses, you'd think that the rectangle was x columns 5..11 and y rows 7..17 ie 7 pixels wide and 11 pixels high, but:
(ii) because they are coordinates, it refers to the pixel area: x columns 5..10 and y rows 7..16 ie 6 pixels wide and 10 pixels high.
The best analogy I've come up with is graph paper: the blue lines are the coordinates, and the squares they enclose are the pixels.
Anyway, where I was heading is that the graphics functions usually draw objects (lines, rectangles, circles) with a pen of a specified stroke width (which is fair enough: because a stroke width of zero would imply drawing nothing). This stroke is
centered on the specified coordinates, and so if you draw a horizontal line at coordinate y = 5 of width 1, then what it actually does is draw half-a-stroke-width
each side of the line, and thus the line is half-a-pixel on pixel row 4 and half-a-pixel on pixel row 5, ie from coordinate y = 4.5 to y = 5.5. The pixels have an alpha (opacity) of 50%, to represent that they are only half-filled. So if your ListView has a border drawn this way, then it will be one stroke-width larger than the .Width and .Height properties. Or, if you clip the ListView to the specified width and height, then the border will be thinner.