A collection of utilities for converting between different display units. These functions are only useful on the Android platform to support devices with different screen densities and resolutions.
To use the measurement builtin library,
require it with the alloy
root directory in your require
call. For example:
var measurement = require('alloy/measurement'); var pointPX = {x:42, y:7}; var pointDP = measurement.pointPXToDP(pointPX);
Converts a density-independent pixel value to screen pixels.
Value in density-independent pixels.
Converted value in screen pixels.
Converts a coordinate (x, y) from screen pixels to density-independent pixels.
Coordinate in screen pixels.
Converted coordinate in density-independent pixels.
Converts a screen pixel value to density-independent pixels.
Value in screen pixels.
Converted value in density-independent pixels.