Class FormExample
Every region marked here becomes a code block on that page, and this file is compiled
by ./gradlew check, so the sample a reader copies is a sample that builds. Each
marker sits BELOW its Javadoc: the site publishes the marked text verbatim, and a doc
comment with @link tags in it is documentation for a reader of this file rather
than a code sample for a reader of the guide.
Deterministic on purpose: the field states shown are set explicitly rather than reached by typing, so two capture runs produce the same pixels.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Widgetform()The form itself: fields, a validated one, a choice, a toggle and the actions.static Scenescene()The form centred on a canvas, for the capture the guide page shows.static WidgetA form in a scroll view, which is where a form of any length ends up.
-
Method Details
-
form
The form itself: fields, a validated one, a choice, a toggle and the actions. -
scrolling
A form in a scroll view, which is where a form of any length ends up.Two things are being said here, and they solve different halves of one complaint.
The padding goes inside. A viewport clips at its own edge, and a focused control paints its ring outside its box: a Button's ring spans −3…−1 (see
Strokes.FOCUS_RING_OUTSET). A field flush against that edge loses the ring that says it is focused. Padding outside the scroll view would not help, because the clip travels with the viewport, not with the box around it.The bar takes a strip.
RESERVEDrather than the overlay default, because every row of a form ends in something the reader is aiming at. An overlay bar is drawn over the viewport and cannot know the content has a margin, so it lands on the trailing edge of the fields themselves. Reserving narrows the content instead, and nothing is ever painted under a bar. Media and prose want the opposite default, and keep it. -
scene
The form centred on a canvas, for the capture the guide page shows.
-