1 Star 0 Fork 0

tangzhan / BottomNavigation-master-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

BottomNavigation

A sample app for Bottom Navigation View with ViewPager ScreenShot

For connecting BottomNavigationView with ViewPager, you need to follow thesesteps

  1. First, you need to create an application with latest Design Support Library(25) to your build.gradle to use BottomNavigationView.

  2. Then add all the necessary resources ( color, drawable’s ) to the resource directory.

  3. Create a view with ViewPager and BottomNavigationView

  4. Create necessary fragments for each tab on the viewpager.

  5. Then setup the viewpager using fragments and viewpager adapter.

  6. Add OnNavigationItemSelectedListener for BottomNavigationView, and override OnNavigationItemSelected method with the relevant action.

  7. Once done with the previous step add OnPageChangeListener to the ViewPager and override the PageSelected method. The magic happens here, the following code selects the relevant item in the BottomNavigationView.

@Override
    public void onPageSelected(int position) {
        if (prevMenuItem != null) {
            prevMenuItem.setChecked(false);
        }
        else
        {
            bottomNavigationView.getMenu().getItem(0).setChecked(false);
        }
       
        bottomNavigationView.getMenu().getItem(position).setChecked(true);
        prevMenuItem = bottomNavigationView.getMenu().getItem(position);
    }
 

For more information, check out my detailed guide here : http://droidmentor.com/bottomnavigationview-with-viewpager-android

空文件

简介

a demo for use Navigation-master 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/tzdecode/BottomNavigation-master-demo.git
git@gitee.com:tzdecode/BottomNavigation-master-demo.git
tzdecode
BottomNavigation-master-demo
BottomNavigation-master-demo
master

搜索帮助