glance-layout-vocabulary
Installation
SKILL.md
What a widget layout can and cannot express
Android only. Widget composables look like ordinary Compose composables and are not: they compile
down to a RemoteViews tree, so every modifier has to have an equivalent in the framework's older view vocabulary. The ones that do not exist simply are not there, and the surprise is always which.
Three absences account for most broken widget layouts:
- No aspect ratio. There is no
aspectRatiomodifier. A square is a square only because you gave it the same width and height. - Weight is always 1, and one-dimensional.
defaultWeight()takes no argument, so an even split is the whole vocabulary — and in a row it sets only the width from the row, leaving the height exactly as declared: the single most common cause of "my square tiles came out rectangular".
Stretch the gaps, not the tiles
The instinct — give each tile a weight so the row distributes them — is precisely what deforms them. Give the tiles a fixed size and put the weight on the spacers between them: