Git Product home page Git Product logo

bottombar's Introduction

轻量级的底部导航栏

在原项目PagerBottomTabStrip 基础上 增加了 getItem 方法,能设置对应 position 的 tab 属性

实现效果图

horizontal vertical
Material 1 Material 2
Material 3 Material 4

自定义扩展例子

仿京东重复刷新动画 普通效果
PagerBottomTabStrip PagerBottomTabStrip
Demo中的例子
PagerBottomTabStrip PagerBottomTabStrip

使用

布局文件中配置

xml文件

<com.ms.bottombar.PageNavigationView
        android:id="@+id/tab"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:background="#FFF" />

java文件中设置

  PageNavigationView bottomTabLayout = (PageNavigationView) findViewById(R.id.tab);
  PageNavigationView.CustomBuilder custom = bottomTabLayout.custom();
  NavigationController build = custom
          .addItem(newItem(android.R.drawable.ic_menu_camera, android.R.drawable.ic_menu_camera, "相机"))
          .addItem(newItem(android.R.drawable.ic_menu_compass, android.R.drawable.ic_menu_compass, "位置"))
          .addItem(newItem(android.R.drawable.ic_menu_search, android.R.drawable.ic_menu_search, "搜索"))
          .addItem(newItem(android.R.drawable.ic_menu_help, android.R.drawable.ic_menu_help, "帮助"))
          .build();
  build.setupWithViewPager(mVpContent);

这样就实现底部导航栏功能了

设置条目选中的监听

 navigationController.addTabItemSelectedListener(new OnTabItemSelectedListener() {
             @Override
             public void onSelected(int index, int old) {
                 //选中时触发
             }

             @Override
             public void onRepeat(int index) {
                 //重复选中时触发
             }
         });

导入方式

dependencies {
        implementation 'com.ms:bottombar:1.0.0'
        implementation 'com.github.wenchaosong:BottomBar:3.0.9'
}

bottombar's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.