底部导航库之AHBottomNavigation
来源:互联网 发布:淘宝店铺旺旺在哪里 编辑:程序博客网 时间:2024/06/01 12:08
(这篇文章是我看了网上的很多列子之后总结的,如有雷同,呵呵)
Ahbottomnavigation 是采用 Material Design 风格设计的底部导航库,要求最小版本SDK为16,比较支持3~5个底部Item项,如果过多就不推荐使用Ahbottomnavigation,过少的话,像只有2个这种也不推荐使用。
如图:
3~5个的效果(推荐):
只有2个的效果(不推荐):
太多的效果(不推荐):
可以自行设置底部每个Item项的风格,但是尽量不要把背景色弄的五颜六色的,只要让用户清楚地知道他选择的是哪一个就行了(如果Ahbottomnavigation本身是彩色的,那么文字和图标尽量用白色或黑色,被选中之后一定要高亮,高亮,高亮,重要的事情说三遍)。
效果图:
使用方法
布局文件中引用:
<com.aurelhubert.ahbottomnavigation.AHBottomNavigation android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" />
在Activity/Fragment中使用:
AHBottomNavigation bottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_navigation);// Create itemsAHBottomNavigationItem item1 = new AHBottomNavigationItem("Label One", R.drawable.ic_maps_place, Color.parseColor("#455C65"));AHBottomNavigationItem item2 = new AHBottomNavigationItem("Label Two", R.drawable.ic_maps_local_bar, Color.parseColor("#00886A"));AHBottomNavigationItem item3 = new AHBottomNavigationItem("Label Three", R.drawable.ic_maps_local_restaurant, Color.parseColor("#8B6B62"));// Add itemsbottomNavigation.addItem(item1);bottomNavigation.addItem(item2);bottomNavigation.addItem(item3);// Set background colorbottomNavigation.setDefaultBackgroundColor(Color.parseColor("#FEFEFE"));// Change colorsbottomNavigation.setAccentColor(Color.parseColor("#F63D2B"));bottomNavigation.setInactiveColor(Color.parseColor("#747474"));// Use colored navigation with circle reveal effectbottomNavigation.setColored(true);// Set listenerbottomNavigation.setAHBottomNavigationListener(new AHBottomNavigation.AHBottomNavigationListener() { @Override public void onTabSelected(int position) { // Do something cool here... }});
AHBottomNavigation的jar包可以在此下载
点这里下载
0 0
- 底部导航库之AHBottomNavigation
- android之底部导航
- 底部导航之BottomNavigationBar
- 底部导航之RadioGroup
- APP之底部导航
- 底部导航之TabLayout+ViewPager
- 《ReactNative》之底部导航TabNavigator
- 项目之底部导航栏
- Fragment之底部导航栏的实现
- 底部导航之TextView+LinearLayout+Fragment
- 项目之底部导航栏(二)
- Android底部导航栏实现之BottomNavigationBar
- Material Design之底部导航栏
- Android之底部导航栏BottomNavigationBar
- android之底部导航页NavigationTabBar
- Android底部导航之-BottomNavigationBar的使用
- 底部导航
- TabHost底部导航知识回顾之模仿微信导航
- linux shell awk获得外部变量(变量传值)简介
- MATLAB中对自定义函数进行参数估计的方法
- linux shell awk 流程控制语句(if,for,while,do)详细介绍
- springmvc拦截器学习(一)
- 数据结构实验之排序七:选课名单
- 底部导航库之AHBottomNavigation
- 一个server启两个实例引发的问题
- linux awk 内置变量使用介绍
- char类型与Unicode的编码
- 4336: BJOI2015 骑士的旅行
- linux awk数组操作详细介绍
- cors 跨域
- CSS white-space 属性
- 《剑指offer》4:替换空格