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]]
        })
    }
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
HarmonyOS
2024-12-24 15:57:57
845浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

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

Row()
  .height(100)
  .width('100%')
  .backgroundColor(0x0A1B1B1B)
  • 1.
  • 2.
  • 3.
  • 4.
分享
微博
QQ
微信
回复
2024-12-24 19:10:44


相关问题
鸿蒙安卓有什么不一样
7134浏览 • 3回复 待解决
Web组件获取高度不一样
3167浏览 • 1回复 待解决
#鸿蒙通关秘籍#HSPHAR有啥不一样
824浏览 • 1回复 待解决