Qml底部导航

作者: zhengtianzuo | 来源:发表于2018-11-29 20:25 被阅读0次

footer加上TabBar即可实现底部导航

footer: TabBar {
        id: bar
        height: 48
        width: parent.width
        currentIndex: 0

        ListModel {
            id: myModel
            ListElement { modelText: "消息"; modelSrc: "qrc:/Chat_MsgRecord.svg"; modelSrcG: "qrc:/Chat_MsgRecordG.svg";}
            ListElement { modelText: "联系人"; modelSrc: "qrc:/Chat_FriendManager.svg"; modelSrcG: "qrc:/Chat_FriendManagerG.svg";}
            ListElement { modelText: "发现"; modelSrc: "qrc:/Mobile_Find.svg"; modelSrcG: "qrc:/Mobile_FindG.svg";}
            ListElement { modelText: "我"; modelSrc: "qrc:/Main_P2PChat.svg"; modelSrcG: "qrc:/Main_P2PChatG.svg";}
        }

        Repeater {
            model: myModel

            TabButton {
                height: bar.height
                contentItem:Text{
                    text: modelText
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignBottom
                    color: (model.index === bar.currentIndex) ? "#148014" : "#000000"
                }
                background:Image{
                    width: 24
                    height: 24
                    anchors.horizontalCenter: parent.horizontalCenter
                    source: (model.index === bar.currentIndex) ? modelSrcG : modelSrc
                }
            }
        }
    }
show.gif

需要完整代码请访问QtQuickExamples

相关文章

  • Qml底部导航

    footer加上TabBar即可实现底部导航 需要完整代码请访问QtQuickExamples

  • BottomNavigationView的属性设置

    底部导航栏 底部导航栏的使用比较常见,目前常用的APP几乎都是使用底部导航栏将内容分类。底部导航栏的实现也比较简单...

  • Android使用底部导航2018-08-16

    Android使用底部导航 Android底部导航停留在屏幕底部,提供应用中顶级视图之间的导航。这是在具有向后兼容...

  • 有一种看似多余的导航你知道吗?

    很多网站在页面底部也有导航,这种底部导航看似有些多余。但是他们的作用不比主导航差。 底部导航的作用和做法有如下几种...

  • 为什么底部导航被人忽视

    很多网站在页面底部也有导航,这种底部导航看似有些多余。但是他们的作用不比主导航差。 底部导航的作用和做法有如下几种...

  • 底部导航思路

    底部导航是每个 app 必备的,有的 app 底部导航做的很精美,很有诱人,于是我去特意看看底部导航都有那些玩法 ...

  • 移动端交互之导航

    讨论两种导航架构在应用中的区分:底部横向导航和侧边纵向导航 1、底部横向导航 特点:横向排列与界面底部,可直接方便...

  • 使用 TabLayout 制作底部导航栏

    国内大部分应用使用底部导航栏, 底部导航栏 是国内 APP 常见的导航方式, 历经: TabActivity -...

  • 安卓底部导航

    Android底部导航栏实现(一)之BottomNavigationBarAndroid底部导航栏实现(二)之Ra...

  • flutter底部导航

    常规App都有一个底部导航,flutter为我们封装好了底部导航组件

网友评论

    本文标题:Qml底部导航

    本文链接:https://www.haomeiwen.com/subject/cskqcqtx.html