智能客服
你问我答,随时在线为你解决问题
通过ListItemGroup中的ListItemGroupStyle设置分组列表的圆角,List的space设置间距。可参考如下代码:
// xxx.ets
@Entry
@Component
struct ListItemGroupExample {
private timeTable: TimeTable[] = [
{ projects: ['language'] },
{ projects: ['mathematics', 'English'] },
{ projects: ['physics', 'chemistry', 'biology'] },
{ projects: ['the fine arts', 'music', 'sport'] }
]
build() {
Column() {
List({ space: 20 }) { // Set the spacing of the grouping list
ForEach(this.timeTable, (item: TimeTable) => {
ListItemGroup({ style: ListItemGroupStyle.CARD }) { // Set the rounded corners of the grouping list
ForEach(item.projects, (project: string) => {
ListItem() {
Text(project)
.width("100%")
.height(100)
.fontSize(20)
.textAlign(TextAlign.Center)
.backgroundColor(0xFFFFFF)
}
}, (item: string) => item)
}
})
}
.width('90%')
.sticky(StickyStyle.Header | StickyStyle.Footer)
.scrollBar(BarState.Off)
}
.width('100%')
.height('100%')
.backgroundColor(0xDCDCDC)
.padding({ top: 5, bottom: 5 })
}
}
interface TimeTable {
projects: string[];
} 智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功