Interface: Size
10/22/22Less than 1 minute
ui.Size
Describes width and height. Values are usually pixel counts; you can also use layout constants WRAP_CONTENT (-2) for “fit content” and MATCH_PARENT (-1) for “fill parent” on each axis.
Table of contents
Properties
Properties
width
Readonlywidth:number
Width in pixels, or WRAP_CONTENT / MATCH_PARENT as above.
Example
const { Size, WRAP_CONTENT, MATCH_PARENT } = require("ui");
// Fixed width
const size1 = { width: 100, height: 200 };
// Width fits content
const size2 = { width: WRAP_CONTENT, height: 200 };
// Width fills parent
const size3 = { width: MATCH_PARENT, height: 200 };height
Readonlyheight:number
Height in pixels, or WRAP_CONTENT / MATCH_PARENT as above.
Example
const { Size, WRAP_CONTENT, MATCH_PARENT } = require("ui");
// Fixed height
const size1 = { width: 100, height: 200 };
// Height fits content
const size2 = { width: 100, height: WRAP_CONTENT };
// Height fills parent
const size3 = { width: 100, height: MATCH_PARENT };