zoukankan      html  css  js  c++  java
  • bottomNavigationBar 底部导航tab MD

    1.先上图:

    此底部Tab完全可以满足日常的开发

    2.使用:

            很简单,使用Gradle构建:compile ‘com.ashokvarma.android:bottom-navigation-bar:0.9.5'

    3.在布局文件中使用

       <com.ashokvarma.bottomnavigation.BottomNavigationBar  

                    android:layout_gravity="bottom"  

                    android:id="@+id/Tab"  

                    android:layout_width="match_parent"  

                    android:layout_height="wrap_content"/>

    4.在Activity中实例化控件,为控件设置属性

     

    BottomNavigationBar bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);

     bottomNavigationBar .addItem(new BottomNavigationItem(R.drawable.ic_home_white_24dp,"Home")) 

      .addItem(new BottomNavigationItem(R.drawable.ic_book_white_24dp,"Books"))

      .addItem(new BottomNavigationItem(R.drawable.ic_music_note_white_24dp,"Music")) 

      .addItem(new BottomNavigationItem(R.drawable.ic_tv_white_24dp,"Movies & TV")) 

      .addItem(new BottomNavigationItem(R.drawable.ic_videogame_asset_white_24dp,"Games")) 

      .initialise();

     

    5.设置监听事件,监听事件有三种状态:

    • 当Item被选中状态
    • 当Item不被选中状态
    • 当Item再次被选中状态

      bottomNavigationBar.setTabSelectedListener(new BottomNavigationBar.OnTabSelectedListener(){

      @Override public void onTabSelected(int position) { } 

      @Override public void onTabUnselected(int position) { } 

      @Override public void onTabReselected(int position) { } 

     }); 

  • 相关阅读:
    通过Vim+少量插件配置一个高效简洁的IDE
    Javascript中Closure及其相关概念
    MongoDB对Javascript的支持
    正则表达式中分组功能高级用法
    NAT穿透解决方案介绍
    平衡二叉树算法分析
    字符串匹配KMP算法详解
    node 内存溢出
    React项目编译node内存溢出
    正则表达正整数/正则表达正整数不包括0
  • 原文地址:https://www.cnblogs.com/qianyukun/p/5367070.html
Copyright © 2011-2022 走看看