ActivityIndicator
优质
小牛编辑
133浏览
2023-12-01
Extends Widget
A widget representing a spinning indicator for indeterminate loading / processing time.
Import this type with “const {ActivityIndicator} = require('tabris');
”
Android | 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
const {ActivityIndicator, Button, ui} = require('tabris');
// Create the activity indicator centered in the page
let activityIndicator = new ActivityIndicator({
centerX: 0,
centerY: 0
}).appendTo(ui.contentView);
// Create reload button
let reloadButton = new Button({
centerX: 0, centerY: 0,
text: 'Run Task'
}).on('select', () => executeLongRunningTask())
.appendTo(ui.contentView);
function executeLongRunningTask() {
// Toggle visibility of elements
activityIndicator.visible = true;
reloadButton.visible = false;
setTimeout(() => {
// Async action is done
activityIndicator.visible = false;
reloadButton.visible = true;
}, 2500);
}
executeLongRunningTask();