当前位置:网站首页>Compose LazyColumn 顶部添加控件
Compose LazyColumn 顶部添加控件
2022-07-03 18:37:00 【安果移不动】
LazyColumn(content = {
item { Text("Headers") }
// stickyHeader { Text("Headers") }
items(names) { name ->
Greeting(name)
}
})
顶部会跟随滑动。如果想黏住不跟着滑动 可以使用
stickyHeader
非常好用
同样的也可以放到底部
于是空态图的写法我们也可以用这个条目
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun Greetings(names: List<String> = List(0) { "$it" }) {
Surface(color = MaterialTheme.colors.surface) {
Column {
LazyColumn(content = {
if (names.isNotEmpty()) {
items(names) { name ->
Greeting(name)
}
} else {
item {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text("没有数据啊")
}
}
}
})
}
}
}
边栏推荐
- After the festival, a large number of people change careers. Is it still time to be 30? Listen to the experience of the past people
- Unity webgl optimization
- Mysql45 lecture learning notes (II)
- Software development freelancer's Road
- How to quickly view the inheritance methods of existing models in torchvision?
- Multifunctional web file manager filestash
- The number of incremental paths in the grid graph [dfs reverse path + memory dfs]
- Redis on local access server
- After nohup NPM start &, close the shell window directly, and the process closes accordingly
- This diversion
猜你喜欢
2022-2028 global marking ink industry research and trend analysis report
Chisel tutorial - 06 Phased summary: implement an FIR filter (chisel implements 4-bit FIR filter and parameterized FIR filter)
SQL injection -day16
Implementation of cqrs architecture mode under Kratos microservice framework
FBI warning: some people use AI to disguise themselves as others for remote interview
Transformer T5 model read slowly
English语法_名词 - 分类
Grammaire anglaise Nom - Classification
Redis on local access server
虚拟机和开发板互Ping问题
随机推荐
Raft log replication
199. Right view of binary tree - breadth search
English語法_名詞 - 分類
Boost.Asio Library
Torch learning notes (7) -- take lenet as an example for dataload operation (detailed explanation + reserve knowledge supplement)
Reading a line from ifstream into a string variable
Count the number of pixel values in the image
SSH 远程执行命令简介
12、 Service management
An academic paper sharing and approval system based on PHP for computer graduation design
Grammaire anglaise Nom - Classification
How does GCN use large convolution instead of small convolution? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)
Why can deeplab v3+ be a God? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)
Raft 日志复制
Software development freelancer's Road
平淡的生活里除了有扎破皮肤的刺,还有那些原本让你魂牵梦绕的诗与远方
Class exercises
Recent learning experience
How to quickly view the inheritance methods of existing models in torchvision?
Multifunctional web file manager filestash