Documentation ¶
Overview ¶
Package unit implements device independent units and values.
A Value is a value with a Unit attached.
Device independent pixel, or dp, is the unit for sizes independent of the underlying display device.
Scaled pixels, or sp, is the unit for text sizes. An sp is like dp with text scaling applied.
Finally, pixels, or px, is the unit for display dependent pixels. Their size vary between platforms and displays.
To maintain a constant visual size across platforms and displays, always use dps or sps to define user interfaces. Only use pixels for derived values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Unit ¶
type Unit uint8
Unit represents a unit for a Value.
const ( // UnitPx represent device pixels in the resolution of // the underlying display. UnitPx Unit = iota // UnitDp represents device independent pixels. 1 dp will // have the same apparent size across platforms and // display resolutions. UnitDp // UnitSp is like UnitDp but for font sizes. UnitSp )
Click to show internal directories.
Click to hide internal directories.