Grato por sua visita. Neste momento esta página está apenas disponível em inglês.

APL ScrollView

A ScrollView holds a single child and scrolls vertically, and can have only one component.

Properties

The ScrollView component has the following properties in addition to the Component properties. See the meaning of the columns here.

The default height and width properties are each set at 100dp.

Property Type Default Styled Dynamic Description
item(s) Array of components [] No No The Component displayed in the ScrollView.
onScroll Array of commands [] No No Command to execute during scrolling.

The ScrollView holds a single child. The child of the ScrollView can be arbitrarily long in the vertical direction. If the child is small enough to fully fit on the screen, no scrolling occurs. To minimize errors, the height of the scroll view defaults to 100dp if not specified.

When the ScrollView component is the target of an event, event.target reports the following values:

"event": {
  "target": {
    "disabled": Boolean, // True if the component is disabled
    "id": ID,            // ID of the component
    "uid": UID,          // Runtime-generated unique ID of the component
    "height": Number,    // Height of the component, in dp (includes the padding)
    "opacity": Number,   // Opacity of the component [0-1]
    "position": Number,  // Scrolled position of the component, as a percentage
    "width": Number      // Width of the component, in dp (includes the padding)
  }
}

The position value reported is calculated in the same way as the value property in the onScroll property.

item

The child component. If more than one component is supplied, the first one selected by the when property is used.

onScroll

An array of commands to execute during scrolling. The runtime attempts to execute these commands once per drawing frame during scrolling, but there is no guarantee that it will succeed. On slow devices the onScroll command may only fire intermittently.

The event.source.value reported in the command is the percentage of the current scroll position as expressed by the height of the scroll view. For example, if the ScrollView is 200 pixels tall and the contents have shifted up by 320 pixels, the reported value is 1.60.

The event generated has the form::

"event": {
  "source": {
    "type": "ScrollView",
    "handler": "Scroll",
    "id": ID,          // ID of the scrollview component
    "uid": UID,        // Runtime-generated unique ID of the component
    "value": Number    // Percentage of the current scroll position
  }
}

Sample ScrollView

{
  "type": "ScrollView",
  "item": {
    "type": "Text",
    "text": "${payload.longTextBlock}"
  }
}