返回介绍

Slider

发布于 2020-10-20 06:58:13 字数 4006 浏览 1019 评论 0 收藏 0

Extends Widget

A widget representing a numeric value as an movable indicator on a horizontal line.

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

AndroidiOS
Slider on AndroidSlider on iOS

Properties

maximum

Type: number, default: 100

The maximum value.

minimum

Type: number, default: 0

The minimum value.

selection

Type: number, default: 0

The actual value.

tintColor

Type: Color

The color used to display the current selection.

Events

maximumChanged

Fired when the maximum property has changed.

Event Parameters

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

  • value: number The new value of maximum.

minimumChanged

Fired when the minimum property has changed.

Event Parameters

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

  • value: number The new value of minimum.

select

Fired when the selection property is changed by the user.

Event Parameters

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

  • selection: number The new value of selection.

selectionChanged

Fired when the selection property has changed.

Event Parameters

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

  • value: number The new value of selection.

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 {Slider, TextView, ui} = require('tabris');

// Create a slider with a selection handler

let textView = new TextView({
  left: 10, right: 10, top: '30%',
  alignment: 'center',
  font: '22px sans-serif',
  text: '50'
}).appendTo(ui.contentView);

new Slider({
  left: 50, top: [textView, 20], right: 50,
  minimum: -50,
  selection: 50,
  maximum: 150
}).on('selectionChanged', ({value}) => textView.text = value)
  .appendTo(ui.contentView);

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文