swift - 滚动视图填充而不减少可滚动区域?
问题描述
我怎样才能使 Text 在滚动视图周围获得一个框架,以便可滚动区域不会减少。如果我要在 ScrollView 周围添加填充,那么小框架将不会接收到滚动视图的拖动。
我有这个布局:
struct ContentView: View{
let width: CGFloat = UIScreen.main.bounds.width
let height: CGFloat = 100
var body: some View{
HStack{
ScrollView(){
Text("""
test test test test
test test test test
test test test test
test test test test
test test test test
test test test test
test test test test
test test
""")
.padding(.vertical)
}
.frame(width: width * 0.5)
}
.frame(width: width * 0.9,height: height)
.background(RoundedRectangle(cornerRadius: 10).foregroundColor(Color.red))
}
}
解决方案
推荐阅读
- node.js - 无法确定主机的真实性。您确定要继续连接(是/否)?
- docker - 无法从 api-service 到 db-service 连接到 docker 容器中的 db 主机,以便在 golang 中使用 goose 进行迁移
- kendo-ui - 在树列表的命令中可见,在 kendoTreeList 中不工作,如 kendoGrid
- regex - 避免对我当前的需求进行灾难性的回溯
- java - 如何将应用使用统计信息存储在文本文件中?
- java - 使用意图时如何在第一个活动中不丢失任何数据
- objectbox - 对象框:每个关系只允许一个@Backlink
- javascript - 为什么我的 Firestore 文档的数组字段总是只更新比我从前端发送的数组少一项?
- javascript - 用于删除选定文件的 Jquery 代码,就像我们在 gmail 中对附件所做的一样
- database - 索引技术