Moj*_*ini 6 grid layout sizing swiftui
我已经使用adaptive
并flexible
有minimum
没有运气的大小。
struct ContentView: View {
let rows = [
GridItem(.adaptive(minimum: 80)) // lowering this cuases an unwanted shrink of text.
]
var body: some View {
LazyVGrid(columns: rows, spacing: 8) {
ForEach((0...10), id: \.self) { item in
Text("\(Int.random(in: 0...50000))")
.background(Color.yellow)
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,似乎它以minimum
大小为单位fixed
!另外,请注意,我不知道最小尺寸,因为它Text
是自行调整尺寸的。
我们如何为LazyVGrid
or提供自定尺码的项目LazyHGrid
?
我希望它看起来像一个标签视图。
归档时间: |
|
查看次数: |
568 次 |
最近记录: |