实现底部导航栏只有图标和图标加文字混合情况下,图标能居中显示的功能BottomNavigationTab类中修改
if (isNoTitleMode || (!isNoTitleMode)) {
labelView.setVisibility(GONE);
LayoutParams layoutParams = (LayoutParams) iconContainerView.getLayoutParams();
layoutParams.gravity = Gravity.CENTER;
setNoTitleIconContainerParams(layoutParams);
iconContainerView.setLayoutParams(layoutParams);
LayoutParams iconLayoutParams = (LayoutParams) iconView.getLayoutParams();
setNoTitleIconParams(iconLayoutParams);
iconView.setLayoutParams(iconLayoutParams);
}
改为 if (isNoTitleMode || (!isNoTitleMode && labelView.getText().equals("")))
定义的时候此时导航栏文字传""就行