2024年最新OpenHarmony HarmonyOS微信的Tab按钮_微信openharmony,阿里社招java面经

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

源码

@Entry
@Component
struct MainPage {
  @State fontColor: Color = Color.Grey
  @State selectedFontColor: Color = Color.Orange
  @State currentIndex: number = 0
  private controller: TabsController = new TabsController()

  @Builder TabBuilder(index: number, name: string) {
    Column() {
      Text(name)
        .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
        .fontSize(16)
        .fontWeight(this.currentIndex === index ? 500 : 400)
        .lineHeight(22)
        .margin({ top: 17, bottom: 7 })

    }.width('100%')
  }

  build() {
    Column() {
      Tabs({ barPosition: BarPosition.End, controller: this.controller }) {
        TabContent() {
          Column(){
            Text("微信").fontSize(50)
          }.width('100%').height('100%').justifyContent(FlexAlign.Center)
        }.tabBar(this.TabBuilder(0, '微信'))

        TabContent() {
          Column(){
            Text("xjg13690").fontSize(50)
          }.width('100%').height('100%').justifyContent(FlexAlign.Center)
        }.tabBar(this.TabBuilder(1, '通讯录'))

        TabContent() {
          Column(){
            Text("发现").fontSize(50)
          }.width('100%').height('100%').justifyContent(FlexAlign.Center)
        }.tabBar(this.TabBuilder(2, '发现'))

        TabContent() {
          Column(){
            Text("坚果").fontSize(50)
          }.width('100%').height('100%').justifyContent(FlexAlign.Center)
        }.tabBar(this.TabBuilder(3, '我'))
      }
      .vertical(false)
      .barMode(BarMode.Fixed)
      .barWidth(360)
      .barHeight(56)
      .animationDuration(400)
      .onChange((index: number) => {
        this.currentIndex = index
      })
      .width(360)


      .backgroundColor('#F1F3F5')
    }.width('100%')


![img](https://img-blog.csdnimg.cn/img_convert/169e5e8d0b3854d526f8da6a54b451fe.png)
![img](https://img-blog.csdnimg.cn/img_convert/8e894691419af3ac7f6f6f9b44c6c2ff.png)

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618636735)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值