Skip to main content
Version: v3

widget.setAlpha(val)

Start from API_LEVEL 2.1 . Please refer to API_LEVEL.

Set the opacity of the widget.

info

For widgets that do not support the alpha property, use widget.setAlpha to set opacity.

Type

(val: any) => void

val

DescriptionType
Transparency, 0 - 255, default value is 255 for opaque, 0 for fullnumber

Code example

import { createWidget, widget, text_style, align } from '@zos/ui'

const text = createWidget(widget.TEXT, {
x: 96,
y: 120,
w: 288,
h: 46,
color: 0xffffff,
text_size: 36,
align_h: align.CENTER_H,
align_v: align.CENTER_V,
text_style: text_style.NONE,
text: 'HELLO ZEPPOS'
})

text.setAlpha(80)