解决措施Button默认背景色挡住渐变颜色设置,需要将背景色backgroundColor设置成全透明才能正常加载渐变。代码示例@Entry @Component struct Index { build() { Button('test') .width(200) .height(50) .backgroundColor('#00000000') .linearGradient({ angle: 90, colors: [[0xff0000, 0.0], [0x0000ff, 0.3], [0xffff00, 1.0]] }) } }参考链接Button
解决措施
Button默认背景色挡住渐变颜色设置,需要将背景色backgroundColor设置成全透明才能正常加载渐变。
代码示例
参考链接
Button