Scroll组件显示不全
为什么这样写,Scroll里面的内容显示不全?最下面的Text不显示了
@Entry
@Component
struct StackDemo {
build() {
Column() {
Text().width(100).height(20).backgroundColor(Color.Green)
Scroll() {
Column(){
Text('11').height(1000).margin(10).backgroundColor(Color.Red)
Text().height(10).width(10).backgroundColor(Color.Gray)
}
}
}
}
}
本文参与了思否 HarmonyOS 技术问答马拉松,欢迎正在阅读的你也加入。
代码中Scroll 组件被嵌套在 Column 组件内部,Column 组件默认会将其所有子组件垂直堆叠。问题可能出在 Scroll 组件没有被赋予足够的空间来显示其内部的所有内容。