HarmonyOS 同一个颜色值,为啥backgroundColor和linearGradient显示的不一样?

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]]
        })
    }
  }
}
阅读 536
1 个回答

backgroundColor使用HEX格式的颜色不需要加引号,请将引号去掉:

Row()
  .height(100)
  .width('100%')
  .backgroundColor(0x0A1B1B1B)