使用的开源库是: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);
最后上一下已做好的优雅界面图: