harmonyOS的List组件架子
scrollBar(BarState.Auto)//BarState.Auto按需显示滚动条BarState.on是常量 off是隐藏。.lanes(2,20)//在100%的盒子中占两列.lanes(2,20),前面的2是几列,后面的20是列一 列之间的距离。.alignListItem(ListItemAlign.Center)//调整对其方式列的对其方式。//变成横向的滚动.listDire
·
import Infotop from '../components/Infotop'
//讨论区适用于ge中评论讨论点赞
@Entry
@Component
struct getgold{
build() {
Column(){
//头部
Infotop()
//主体
//List组件是更强大的Scorll组件,当里面的内容超出本身的容量之后,会自动形成可以下拉
List(){
//子组件只能放ListItem
ForEach(Array.from({length:20}),() =>{
ListItem(){
Row(){}.width('100%').height(100).backgroundColor(Color.Green)
}
.padding(10)
})
}
//变成横向的滚动.listDirection(Axis.Horizontal)
.listDirection(Axis.Vertical)//调整主轴方向
.width('100%')
.backgroundColor(Color.Orange)
//高度自适应
.layoutWeight(1)
.lanes(2,20)//在100%的盒子中占两列.lanes(2,20),前面的2是几列,后面的20是列一 列之间的距离
.alignListItem(ListItemAlign.Center)//调整对其方式列的对其方式
.scrollBar(BarState.Auto)//BarState.Auto按需显示滚动条BarState.on是常量 off是隐藏
//分割线
.divider({
strokeWidth :3,//线宽
color:Color.Black,
startMargin:10,//给线添加 marrgin
endMargin:10//另外一边的marrgin
})
//尾部
Row(){
}
.width('100%')
.height(100)
.backgroundColor(Color.Pink)
}
.height('100%')
.width('100%')
}
}

更多推荐
所有评论(0)