#鸿蒙通关秘籍#自定义tabbar可以吗?我看里边既可以用text还能用img得

HarmonyOS
2024-12-10 09:00:45
782浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
hm673ff10ccce15

当然可以实现了,你用 @builder,把你想实现的布局放进去:

@Builder
tabBuilder(index: number) {
    Column() {
        Image(this.selectedIndex === index ? '/common/public_icon_on.svg' : '/common/public_icon_off.svg')
        .width(24)
        .height(24)
        .margin({ bottom: 4 })
        .objectFit(ImageFit.Contain)
        Text('Tab')
        .fontColor(this.selectedIndex === index ? this.selectedFontColor : this.fontColor)
        .fontSize(10)
        .fontWeight(500)
        .lineHeight(14)
    }.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
分享
微博
QQ
微信
回复
2024-12-10 11:38:27


相关问题
har包不能用worker,taskpool可以吗
2977浏览 • 1回复 待解决
可以用JS来开发鸿蒙应用
443浏览 • 1回复 已解决
可以用Java来开发鸿蒙应用
429浏览 • 2回复 已解决
可以用仓颉来开发鸿蒙应用
411浏览 • 1回复 已解决
HarmonyOS 可以用仓颉开发HarmonyOS
995浏览 • 1回复 待解决
智慧推荐可以自定义app
8659浏览 • 1回复 待解决
DevEco Studio 可以用 安卓手机调试
5999浏览 • 1回复 待解决
可以用JS UI组件来做进度展示
6619浏览 • 1回复 待解决