当前位置:网站首页>Jetpack Compose Scaffold和BottomAppBar(底部导航)
Jetpack Compose Scaffold和BottomAppBar(底部导航)
2022-06-11 01:26:00 【ScottePerk】
Jetpack Compose 以下简称JC
JC提供了Scaffold这个组件来实现一些导航的效果,例如顶部菜单,底部导航,旁边的抽屉菜单等等,Scaffold的意思是脚手架,也就是Scaffold这是提供的一个支架,或者说固定了一些控件实现的位置。下面通过实现BottomAppBar来说明。
bottomBar是Scaffold的一个属性,类似的属性还有topbar,这篇文章只介绍bottomBar。
topbar可以看这篇文章:topBar
主要用到的类其实就是BottomAppBar,这个类也没什么特别的,其实就是自动定位到底部了,你手写也能实现,只是比较麻烦。
需要注意的点其实就是Icon和文本的居中对齐,整体颜色可以用contentColor属性修改,也可以自己一个个改。
Scaffold(
bottomBar = {
BottomAppBar(contentColor = Color.Yellow, backgroundColor = Color(0xffcc00ff)) {
Row(modifier = Modifier.fillMaxSize().wrapContentSize(Alignment.Center)){
IconButton(onClick = {
}) {
Column(horizontalAlignment = Alignment.CenterHorizontally ) {
Text("主页" , fontWeight = FontWeight.Bold)
Icon(imageVector = Icons.Default.Home , contentDescription = "主页")
}
}
IconButton(onClick = {
}, modifier = Modifier.padding(50.dp,0.dp,50.dp,0.dp)) {
Column(horizontalAlignment = Alignment.CenterHorizontally ) {
Text("发现" ,fontWeight = FontWeight.Bold)
Icon(imageVector = Icons.Default.Search , contentDescription = "发现")
}
}
IconButton( onClick = {
}) {
Column(horizontalAlignment = Alignment.CenterHorizontally ) {
Text("设置" ,fontWeight = FontWeight.Bold)
Icon(imageVector = Icons.Default.Settings , contentDescription = "设置")
}
}
}
}
}
) {
}

边栏推荐
- Md61 plan independent demand import Bapi [by daily dimension / dynamic template / dynamic field]
- 从测试零基础到测试架构师,这10年,他是这样让自己成才的
- Orcale driver
- Blue Bridge Cup: the sixth preliminary round - "temperature recorder"
- Analysis of common ADB commands
- npm ERR Fix the upstream dependency conflict, or retry
- Find - (sequential search)
- 为什么有的程序员能力一般却能拿到好offer?
- ME11/ME12采购信息记录及条件记录创建及更新BAPI:ME_INFORECORD_MAINTAIN_MULTI
- 环糊精金属有机骨架(β-CD-MOF)装载二巯丁二酸/大黄素/槲皮素/三氯蔗糖/二氟尼柳/奥美拉唑(OME)
猜你喜欢

The interviewer of Tencent said that who knows the internal module index principle and performance optimization idea of MySQL architecture?

技术分享| 快对讲,全球对讲

腾讯面试官曰Mysql架构的内部模块索引原理及性能优化思路谁会?

CRS-4544 & ORA-09925

浅析直播间海量聊天消息的架构设计难点

2022 high altitude installation, maintenance and removal of simulated examination platform of theoretical question bank

Find - (half find / half find)

Koa2 learning notes

CRS-4544 & ORA-09925

腾讯测试开发岗面试上机编程题
随机推荐
[penetration test tool bee] how to install and use the XSS penetration test tool bee?
Introduction for i-Teams
14: 00 interview, came out at 14:08, the question is really too
[3.delphi common components] 7 timer
贵金属白银和现货白银之间是什么关系
NFT Insider #61:Animoca Brands 在 340 项投资中持有 15 亿美元的加密资产
1031. maximum sum of two non overlapping subarrays
Shell learning tutorial (super detailed and complete)
ABAP CDs realizes multi line field content splicing
Go develop web
Ortele has obtained three rounds of financing nine months after its establishment, and hard discount stores have found new ways to grow?
优化调度(火电、风能、储能)【matlab代码实现】
378. 有序矩阵中第 K 小的元素
Test questions and answers of 2022r1 quick opening pressure vessel operation certificate
查看Redis内数据,除了命令行和客户端,你还有第三种选择
The diligent is the laziest
The annual salary of testers in large factories ranges from 300000 to 8K a month. Roast complained that the salary was too low, but he was ridiculed by netizens?
Switch case uses enumeration classes to compare
Knowledge competition of safety production month -- how much do you know about new safety law
为什么有的程序员能力一般却能拿到好offer?