demo代码:
import { promptAction } from '@kit.ArkUI';
@Entry
@Component
struct Index23123 {
build() {
Column(){
Row()
.height(100)
.width('100%')
.backgroundColor('0x0A1B1B1B')
Row()
.height(100)
.width('100%')
.linearGradient({
direction: GradientDirection.Left,
colors: [[0x0A1B1B1B, 0.0],
[0x0A1B1B1B, 1.0]]
})
}
}
}
backgroundColor使用HEX格式的颜色不需要加引号,请将引号去掉: