本文共 1556 字,大约阅读时间需要 5 分钟。
本应用已上线百度手机助手、ViVo应用商店
详情地址:底部导航栏四个按钮代表四个颜色,点其中其中一个按钮,则换一种颜色,颜色代码和图标都保存在相应的数组里,具体如下:
使用的开源库是:LuseenBottomNavigation
本应用《任您记)APP项目中用法是依赖:compile 'com.github.armcha:LuseenBottomNavigation:1.8.2'主要代码:
if (bottomNavigationView != null) {
bottomNavigationView.isWithText(false);bottomNavigationView.isColoredBackground(true);bottomNavigationView.setTextActiveSize(getResources().getDimension(R.dimen.dp_18));bottomNavigationView.setTextInactiveSize(getResources().getDimension(R.dimen.dp_18));bottomNavigationView.setItemActiveColorWithoutColoredBackground(ContextCompat.getColor(this, R.color.colorPrimary));bottomNavigationView.setFont(Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/chinese_character.ttf"));}BottomNavigationItem bottomNavigationItem = new BottomNavigationItem ("待办", color[0], image[0]); BottomNavigationItem bottomNavigationItem1 = new BottomNavigationItem ("日记", color[1], image[1]); BottomNavigationItem bottomNavigationItem2 = new BottomNavigationItem ("账单", color[2], image[2]); BottomNavigationItem bottomNavigationItem3 = new BottomNavigationItem ("纪念日", color[3], image[3]); bottomNavigationView.addTab(bottomNavigationItem); bottomNavigationView.addTab(bottomNavigationItem1); bottomNavigationView.addTab(bottomNavigationItem2); bottomNavigationView.addTab(bottomNavigationItem3); bottomNavigationView.setOnBottomNavigationItemClickListener(this);
最后上一下已做好的优雅界面图:
手机扫描下面二维码,即可下载该手机应用软件:
转载于:https://blog.51cto.com/1206995290qq/2157703