本文整理汇总了Java中com.aurelhubert.ahbottomnavigation.AHBottomNavigationAdapter类的典型用法代码示例。如果您正苦于以下问题:Java AHBottomNavigationAdapter类的具体用法?Java AHBottomNavigationAdapter怎么用?Java AHBottomNavigationAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AHBottomNavigationAdapter类属于com.aurelhubert.ahbottomnavigation包,在下文中一共展示了AHBottomNavigationAdapter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationAdapter; //导入依赖的package包/类
@Override
public void start(Bundle savedInstanceState) {
AHBottomNavigationAdapter navigationAdapter = new AHBottomNavigationAdapter(activity, R.menu.menu_bottom_bar);
navigationAdapter.setupWithBottomNavigation(bottomNavigation, null);
final int accentColor;
final int backgroundColor;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
accentColor = activity.getResources().getColor(R.color.primary, null);
backgroundColor = activity.getResources().getColor(R.color.bottom_nav_background, null);
} else {
accentColor = activity.getResources().getColor(R.color.primary);
backgroundColor = activity.getResources().getColor(R.color.bottom_nav_background);
}
bottomNavigation.setColored(false);
bottomNavigation.setDefaultBackgroundColor(backgroundColor);
bottomNavigation.setBehaviorTranslationEnabled(false);
bottomNavigation.setAccentColor(accentColor);
bottomNavigation.setOnTabSelectedListener(new BottomNavigationItemListener());
}
示例2: setupBottomNavigation
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationAdapter; //导入依赖的package包/类
private void setupBottomNavigation() {
AHBottomNavigationAdapter adapter = new AHBottomNavigationAdapter(this, R.menu.navigation_home);
adapter.setupWithBottomNavigation(bottomNavigation, null);
bottomNavigation.setDefaultBackgroundColor(ContextCompat.getColor(this, R.color.bottom_navigation_background));
bottomNavigation.setAccentColor(ContextCompat.getColor(this, R.color.bottom_navigation_item));
bottomNavigation.setInactiveColor(ContextCompat.getColor(this, R.color.bottom_navigation_item_inactive));
bottomNavigation.setForceTitlesHide(true);
bottomNavigation.setOnTabSelectedListener((position, wasSelected) -> {
presenter.onTabSelected(position, wasSelected);
return true;
});
}