標籤:底部導覽列 -o mpi 用法 一個 RoCE lse tco 導覽列
底部導覽列四個按鈕代表四個顏色,點其中其中一個按鈕,則換一種顏色,顏色代碼和表徵圖都儲存在相應的數組裡,具體如下:
使用的開源庫是: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);
最後上一下已做好的優雅介面圖:
記錄一下本應用《任您記)APP項目中點擊底部導覽列四個按鈕,則介面顏色跟著變化及表徵圖字放大效果