HarmonyOS Toggle点击时要怎么关闭阴影

HarmonyOS
2024-12-24 16:51:40
729浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
superinsect

可以试下一下demo:

@Entry
@Component
struct ToggleExample {
  build() {
    Column({ space: 10 }) {
      Text('type: Switch').fontSize(12).fontColor(0xcccccc).width('90%')
      Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
        Toggle({ type: ToggleType.Switch, isOn: false })
          .selectedColor('#007DFF')
          .switchPointColor('#FFFFFF')
          .onChange((isOn: boolean) => {
            console.info('Component status:' + isOn)
          }).hoverEffect(HoverEffect.None)

        Toggle({ type: ToggleType.Switch, isOn: false })
          .selectedColor('#007DFF')
          .switchPointColor('#FFFFFF')
          .onChange((isOn: boolean) => {
            console.info('Component status:' + isOn)
          })
      }
    }.width('100%').padding(24)
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.

.hoverEffect(HoverEffect.None)可以去掉灰色背景。

分享
微博
QQ
微信
回复
2024-12-24 19:01:47


相关问题
HarmonyOS UI组件需要加阴影怎么实现
734浏览 • 1回复 待解决
HarmonyOS toggle 点击拦截
925浏览 • 1回复 待解决
HarmonyOS Toggle组件怎么拦截?
1377浏览 • 1回复 待解决
如何去掉Toggle一类控件的点击效果
1009浏览 • 1回复 待解决
HarmonyOS Toggle空间的勾颜色怎么修改?
1060浏览 • 1回复 待解决
HarmonyOS 页面转场,页面模糊
469浏览 • 1回复 待解决