鸿蒙小记

鸿蒙小记
Photo by Kenzo Tu / Unsplash

自定义Component不能作为根容器

自定义Component不能直接作为@Entry注解的组件的根组件,如果想用,需要套一层系统的容器组件

Scroll无法滚动

Scroll的直接子组件,滚动方向上的尺寸,一定不能设置为100%,设置后无法滚动

Scroll() {
  Row()
    .height('100%')
}
.scrollable(ScrollDirection.Vertical)

RelativeContainer chainWeight存在顺序问题

ItemPlaneView()
  .id("item1")
  .alignRules({
    left: { anchor: "__container__", align: HorizontalAlign.Start },
    right: { anchor: "item2", align: HorizontalAlign.Start },
    top: { anchor: "title", align: VerticalAlign.Bottom }
  })
  .chainWeight({ horizontal: 1 })

如果chainWeight放在alignRules之前,运行会报错:
Reason:Signal:SIGSEGV(SEGV_MAPERR)@0x0000000000000110 probably caused by NULL pointer dereference

SVG着色后没有图形,颜色全是设置的颜色

鸿蒙对svg的着色只对path的fill属性有效,对stroke无效