【发布时间】:2021-09-03 14:19:51
【问题描述】:
在 SwiftUI 中,我将如何更改列表周围的背景颜色?我尝试过使用各种ZStack 和.listRowBackground(Color.clear),但没有运气。这是一些示例代码。
struct SwiftUIView: View {
var body: some View {
ZStack(alignment: .top) {
Color(.blue)
VStack {
List(0 ..< 5) { item in
HStack {
Image(systemName: "clock")
Text("Placeholder")
}
}
}
}
}
}
【问题讨论】:
-
这是否回答了您的问题stackoverflow.com/a/65093021/12299030?
-
好吧,也许我遗漏了一些东西,但
listRowBackground只是更改了列表背景颜色,而不是列表周围的区域。
标签: swiftui swiftui-list