AHBottomNavigation

[复制链接]
来自: chino 分类: Android精品源码 上传时间: 2016-3-23 11:22:35
Tag:

项目介绍:



AHBottomNavigation
Library to implement the Bottom Navigation component from Material Design guidelines (minSdkVersion=16).
Demo


Features

How to?Gradle
[XML] 查看源文件 复制代码
dependencies {
    compile 'com.aurelhubert:ahbottomnavigation:0.1.5'
}


XML
[XML] 查看源文件 复制代码

OR
[XML] 查看源文件 复制代码


    ...

    



Activity/Fragment
[XML] 查看源文件 复制代码
AHBottomNavigation bottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_navigation);

// Create items
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.tab_1, R.drawable.ic_maps_place, R.color.color_tab_1);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.tab_2, R.drawable.ic_maps_local_bar, R.color.color_tab_2);
AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.tab_3, R.drawable.ic_maps_local_restaurant, R.color.color_tab_3);

// Add items
bottomNavigation.addItem(item1);
bottomNavigation.addItem(item2);
bottomNavigation.addItem(item3);

// Set background color
bottomNavigation.setDefaultBackgroundColor(Color.parseColor("#FEFEFE"));

// Disable the translation inside the CoordinatorLayout
bottomNavigation.setBehaviorTranslationEnabled(false);

// Change colors
bottomNavigation.setAccentColor(Color.parseColor("#F63D2B"));
bottomNavigation.setInactiveColor(Color.parseColor("#747474"));

// Force to tint the drawable (useful for font with icon for example)
bottomNavigation.setForceTint(true);

// Force the titles to be displayed (against Material Design guidelines!)
bottomNavigation.setForceTitlesDisplay(true);

// Use colored navigation with circle reveal effect
bottomNavigation.setColored(true);

// Set current item programmatically
bottomNavigation.setCurrentItem(1);

// Set listener
bottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {
    @Override
    public void onTabSelected(int position, boolean wasSelected) {
        // Do something cool here...
    }
});

TODO
  • Add color under the navigation bar.
  • Manage tablet
Contributions
Feel free to create issues / pull requests.

相关源码推荐:

我来说两句
所有评论(38)
lh2018 2016-3-23 12:52:22
学习学习!
回复
ushang000 2016-3-23 14:08:32
学习学习
回复
lh2018 2016-3-24 16:06:54
淡定,淡定,淡定……
回复
lh2018 2016-3-24 16:07:22
学习学习!
回复
李辉_eKxJ2 2016-3-24 22:47:23
正需要啊,感谢楼主无私分享!
回复
曼特宁 2016-3-29 10:42:41
学习学习!
回复
EitteTL 2016-5-27 11:39:33
很给力,安卓巴士有你更精彩!
回复
12345下一页
提取码:  下载次数:19 状态:已购或VIP 售价:10(原价:10)金钱 下载权限:初级码农 
4052 0 19
代码贡献英雄榜
用户名 下载数
联系我们
首页/微信公众账号投稿
帖子代码编辑/版权问题
QQ:435399051,1294855032
如何获得代码达人称号?
如何成为签约作者?
领先的中文移动开发者社区
18620764416
7*24全天服务
意见反馈:1294855032@qq.com

扫一扫关注我们

Powered by Discuz! X3.2© 2001-2019 Comsenz Inc.( 粤ICP备15117877号 )