HarmonyOS鸿蒙Next中Column包含一个image和row,row包含一个TextInput,TextInput没有显示是为啥
HarmonyOS鸿蒙Next中Column包含一个image和row,row包含一个TextInput,TextInput没有显示是为啥
5 回复
方便提供下最小复现demo吗?
更多关于HarmonyOS鸿蒙Next中Column包含一个image和row,row包含一个TextInput,TextInput没有显示是为啥的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
text组件可能是没给尺寸,虽然有默认尺寸,但是在容器使用了ALIgn等一些属性时,默认尺寸会失效。所以你可以直接给text、和外部组件一个固定尺寸试一下,看看是否是默认尺寸失去作用了
你好。
经过测试没有问题。可参考以下代码:
```typescript
[@Entry](/user/Entry)
[@Component](/user/Component)
struct InputTestPage {
build() {
Column() {
Image($r("app.media.icon_harmonyos"))
.size({
width: px2vp(600),
height: px2vp(200)
})
Row(){
TextInput({
placeholder: "请输入"
})
}
}
.height('100%')
.width('100%')
.justifyContent(FlexAlign.Center)
}
}
先试试给组件固定的大小,宽度和高度有了就不怕它不显示