harmony 鸿蒙Hover Effect
Hover Effect
The hover effect is applied to a component in hover state.
NOTE
The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
Attributes
Name | Type | Description |
---|---|---|
hoverEffect | HoverEffect | Hover effect of the component in hover state. Default value: HoverEffect.Auto |
Example
// xxx.ets
@Entry
@Component
struct HoverExample {
@State isHoverVal: boolean = false
build() {
Column({ space: 5 }) {
Column({ space: 5 }) {
Text('Scale').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 80 })
Column()
.width('80%').height(200).backgroundColor(Color.Gray)
.position({ x: 40, y: 120 })
.hoverEffect(HoverEffect.Scale)
.onHover((isHover?: boolean) => {
console.info('Scale isHover: ' + isHover as string)
this.isHoverVal = isHover as boolean
})
Text('Board').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 380 })
Column()
.width('80%').height(200).backgroundColor(Color.Gray)
.hoverEffect(HoverEffect.Highlight)
.position({ x: 40, y: 420 })
.onHover((isHover?: boolean) => {
console.info('Highlight isHover: ' +isHover as string)
this.isHoverVal = isHover as boolean
})
}
.hoverEffect(HoverEffect.None)
.width('100%').height('100%').border({ width: 1 })
.onHover((isHover?: boolean) => {
console.info('HoverEffect.None')
this.isHoverVal = isHover as boolean
})
}
}
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙ArkTS-based Declarative Development Paradigm
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦