Merci de votre visite. Cette page est disponible en anglais uniquement.

APL Sequence

A Sequence uses a data set to inflate a repeating set of components and display them in a long scrolling list. See Alexa Design Guide–Sequence for guidance on using sequences to develop a good user experience in Alexa skills.

A Sequence is similar to a Container. Inside a ScrollView, a Sequence will have better performance on long lists, but a less flexible layout model.

You can also use a Sequence to allow ordinal and anaphor-based selection of items on the screen. See APL Support for Item Selection.

Properties

The Sequence component has the following properties in addition to the standard component properties. The default height and width properties are each set at 100dp.

Property Type/Value Required Styled Description
data Data: Properties No No Data to bind into this container.
scrollDirection horizontal | vertical Yes No The direction to scroll this sequence. Defaults to vertical.
firstItem Array of component or layouts No No A component to include before all others.
item(s) Array of component or layouts Yes No The Component(s) used to lay out the data set.
lastItem Array of component or layouts No No A component to include after all others.
numbered boolean No No If true, assign ordinal numbers to children. Defaults to false.

The children of a sequence are laid out in a continuous strip (either left-to-right or top-to-bottom). The dimension of the child component along the scrolling axis is auto, meaning that it wraps the content of the child by default.

To minimize visibility errors, the height of a vertical sequence and the width of a horizontal sequence are initialized to 100dp if they are not specified.

Any item template inside a vertical Sequence that has a height value must use absolute dimensions and cannot have height set as a percentage value. Any item inside a horizontal Sequence that has a width value must use absolute dimensions and cannot have width set as a percentage value.

data

An array of arbitrary data. If the data array is bound, the sequence uses the data array inflation method.

scrollDirection

The scrollDirection is either vertical or horizontal. Default is vertical.

numbered

If true, set the data-binding ordinal for each of the items in the sequence. The ordinals start with "1" and increment by one unless the numbering property in a child is set to "skip" or "reset". Note that the firstItem and lastItem do not participate in ordinal numbering. Default is false.

Sequence children

The children of a sequence lay out in a continuous strip (either left-to-right or top-to-bottom). The dimension of the child along the scrolling axis is auto; that is, it wraps the content of the child by default.

Child properties

The children of a Sequence support the following additional properties.

Property Type/Value Required Styled Dynamic Description
numbering normal, skip, or reset No No No Control ordinal numbering of the next child. Defaults to normal.
spacing Absolute dimension No No No Additional space to add between this component and the previous component in the layout.

numbering

Controls the ordinal value when the parent has set numbered. This property controls how the ordinal value will be updated for the next child in the sequence, not the current child in the sequence.

  • normal: The next child's ordinal = ordinal + 1.
  • skip: The next child's ordinal = ordinal
  • reset: The next child's ordinal = 1

spacing

An amount of spacing to add between this component and the previous component in the sequence. The first item in the sequence ignores spacing. The value must be expressed in absolute dimensions.