ActivityIndicator

Extends Widget

A widget representing a spinning indicator for indeterminate loading / processing time.

Import this type with “const {ActivityIndicator} = require('tabris');

Android iOS
ActivityIndicator on Android ActivityIndicator on iOS

Properties

tintColor

iOSAndroid

Type: Color

The color of the indicator.

Events

tintColorChanged

Fired when the tintColor property has changed.

Event Parameters

  • target: this The widget the event was fired on.

  • value: Color The new value of tintColor.

Example

  1. const {ActivityIndicator, Button, ui} = require('tabris');
  2. // Create the activity indicator centered in the page
  3. let activityIndicator = new ActivityIndicator({
  4. centerX: 0,
  5. centerY: 0
  6. }).appendTo(ui.contentView);
  7. // Create reload button
  8. let reloadButton = new Button({
  9. centerX: 0, centerY: 0,
  10. text: 'Run Task'
  11. }).on('select', () => executeLongRunningTask())
  12. .appendTo(ui.contentView);
  13. function executeLongRunningTask() {
  14. // Toggle visibility of elements
  15. activityIndicator.visible = true;
  16. reloadButton.visible = false;
  17. setTimeout(() => {
  18. // Async action is done
  19. activityIndicator.visible = false;
  20. reloadButton.visible = true;
  21. }, 2500);
  22. }
  23. executeLongRunningTask();

See also

原文:

https://youjingyu.github.io/Tabris-Documention/?folderName=widgets&pageName=ActivityIndicator.html