ThemeStore Store Docs FAQ
Documentation

Layout and geometry

Where an element actually sits: the coordinate system, sizing, stacking order, and the containers that take the decision away from you.

On this page

There are no margins in this format, no anchors, no constraints and no rows and columns to drop things into. Every element has an x and a y, and that is the whole layout system.

It sounds primitive until you remember that both are formulas. A position that can read screen_width and the size of another element is a constraint system. You write it out rather than configure it.

The coordinate system#

x and y are in dp (density independent pixels), measured from the top left of the page. Larger y is further down.

dp rather than real pixels means the same number is the same physical size on a dense screen and a coarse one. What it does not account for is the shape of the screen, which is why a position that reads screen_height survives a device you have never seen and a position that says 2200 does not. See different screens.

Inside a group, coordinates are relative to the group. Moving the group moves its contents, which is the reason to use one.

Size#

width and height are dp, and both may be left out. An element without them sizes itself to its content: a text element becomes as wide as its text, an icon as large as its natural size.

Leaving them out is usually right for text and usually wrong for anything you want to line up, because content sized elements change size when their content does. A clock that switches from 09:59 to 10:00 gets wider, and anything positioned relative to its right edge moves.

Stacking#

Elements are drawn in the order they appear in the page's components array: later is on top. The Layers tab is that array, which is why dragging a row there changes what covers what.

Two consequences that cause real confusion:

  • A transparent element still catches taps. opacity: "0" hides an element visually and changes nothing else; it is measured, drawn and touchable. An invisible full-screen shape above your icons is a theme where nothing can be launched. To remove an element properly, use hidden, which takes it out entirely.
  • The last element wins the tap where two overlap. If a button stopped working after you added a card behind it, check that the card really is behind it in the array.

Moving without re-measuring#

x/y and translateX/translateY both move an element, and they are not the same thing.

x and y are layout: change them and the element is positioned again. translateX and translateY are applied afterwards, during drawing. Nothing is measured, and nothing else moves.

For anything that changes continuously, such as a parallax on page_position or a nudge on a spring, use the translate pair. It is cheaper, and it cannot push a neighbour around by accident. Keep x/y for where the element lives.

Containers#

A group with layout: "free" is a box you position things inside. A group with layout: "list" is different in kind: it stacks its children in array order, puts spacing dp between them, and scrolls them together. Inside a list container, y means nothing: order does.

That is worth stating plainly because it is the one place where writing a y has no effect at all, and the natural conclusion is that something is broken.

A grid inside a list container needs autoHeight, or you have two scrollable things fighting over one finger. See app grids.

Grid geometry#

An app_grid divides its own width by gridColumns, and that is the cell width. itemSize is the icon inside the cell, not the cell.

The trap is fixing one and deriving the other. A dock with a fixed height and a column count computed from screen_width has near square cells on a phone and flat, wide ones on a tablet. The icons stay put and the labels drift. Derive both from the same measurement, or fix the cell and let the count vary.

The background layer#

One page in a theme is the background. In the editor it has its own button, Background in the page overview, and Back to pages to leave it again. It has no place in the page grid: you cannot swipe to it and no cable can be plugged into it, because it has no edges.

It is the right home for whatever should not move when you swipe. On the default theme, the dock and the search pill.

It is drawn in two halves, and they end up on opposite sides of your pages.

HalfWhere it lands
Its fill (wallpaper, colour, gradient, dim, blur)Underneath everything. This is what shows through the gap a slide transition opens between two pages.
Its elements (dock, search pill, page dots)On top of the pages, not behind them.

The second one surprises people, so it is worth being blunt about: the dock is above your page, not below it. It has to be, because a tap only ever reaches the topmost element under the finger, and a dock drawn underneath would be visible and dead.

What follows from it:

  • A full-screen element on a normal page does not cover the dock. It is underneath it.
  • Outside the bounds of those elements, the page below is fully operable. The layer is not a sheet over the screen; it is only as large as what you put on it.
  • A page that arrives with cover gets rid of it. When such a page is fully in front and standing still, the element layer is not merely hidden: it is not built at all, so an invisible dock cannot swallow taps in the middle of a feed. During an overlay, fade or zoom it stays and blurs along with the page behind it, which is why a glass drawer still has a dock shimmering underneath.

Two more things live here rather than on each page:

  • dimAlpha is a formula, so the whole layer can darken as a page is pulled over it.
  • Its backgroundClickActions are inherited. A page that defines none of its own uses the background page's, so "tap the wallpaper to open search" is written once.

Finally, the background page's fill is what the launcher hands to the live wallpaper, and what the library thumbnails and the store screenshots are rendered against. A theme whose background page is empty looks empty in the store, even if every other page is full.

Documentation for launcher 0.1.0-alpha Android 12 and later last updated