本文整理汇总了Java中com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem类的典型用法代码示例。如果您正苦于以下问题:Java AHBottomNavigationItem类的具体用法?Java AHBottomNavigationItem怎么用?Java AHBottomNavigationItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AHBottomNavigationItem类属于com.aurelhubert.ahbottomnavigation包,在下文中一共展示了AHBottomNavigationItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBottomNavigation
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
/**
* 初始化底部导航
*/
private void initBottomNavigation() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.news, R.drawable.ic_new, R.color.black);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.video, R.drawable.ic_video, R.color.black);
AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.weather, R.drawable.ic_weather, R.color.black);
AHBottomNavigationItem item4 = new AHBottomNavigationItem(R.string.person_center, R.drawable.ic_person_center, R.color.black);
mBottomNavigation.addItem(item1);
mBottomNavigation.addItem(item2);
mBottomNavigation.addItem(item3);
mBottomNavigation.addItem(item4);
mBottomNavigation.setAccentColor(Color.parseColor("#000000"));
mBottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
mBottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {
@Override
public boolean onTabSelected(int position, boolean wasSelected) {
switchFragment(position);
return true;
}
});
}
示例2: initBottomBar
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void initBottomBar() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem("Tab1", R.drawable.sel_main_home, R.color.cyan);
AHBottomNavigationItem item2 = new AHBottomNavigationItem("Tab1", R.drawable.sel_main_design, R.color.gray);
AHBottomNavigationItem item3 = new AHBottomNavigationItem("Tab1", R.drawable.sel_main_show, R.color.green);
AHBottomNavigationItem item4 = new AHBottomNavigationItem("Tab1", R.drawable.sel_main_me, R.color.blue);
mAHBottomNavigation.setDefaultBackgroundColor(Color.DKGRAY);
mAHBottomNavigation.setForceTint(true);
mAHBottomNavigation.addItem(item1);
mAHBottomNavigation.addItem(item2);
mAHBottomNavigation.addItem(item3);
mAHBottomNavigation.addItem(item4);
mAHBottomNavigation.setUseElevation(true);
}
示例3: setupViews
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void setupViews() {
accountSwipeRefresh.setColorSchemeResources(R.color.swipe_refresh);
accountSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
accountPresenter.loadEmployeeAccount(true);
}
});
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.tab_gratitudes, R.drawable.ic_recommendations, R.color.colorAccent);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.tab_achievements, R.drawable.ic_badges, R.color.colorAccent);
bottomNavigation.addItem(item1);
bottomNavigation.addItem(item2);
bottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
bottomNavigation.setAccentColor(Color.parseColor(navigationColor));
bottomNavigation.setBehaviorTranslationEnabled(false);
}
示例4: setTabButton
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
public void setTabButton(ScreenParams params, Integer index) {
if (params.tabIcon != null || params.tabLabel != null) {
AHBottomNavigationItem item = this.getItem(index);
boolean tabNeedsRefresh = false;
if (params.tabIcon != null) {
item.setDrawable(params.tabIcon);
tabNeedsRefresh = true;
}
if (params.tabLabel != null) {
item.setTitle(params.tabLabel);
tabNeedsRefresh = true;
}
if (tabNeedsRefresh) {
this.refresh();
}
}
}
示例5: bottomNavigationItems
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
public List<AHBottomNavigationItem> bottomNavigationItems() {
List<AHBottomNavigationItem> result = new ArrayList<>();
for (NavigationItem item : this) {
result.add(item.ahItem);
}
return result;
}
示例6: initBottomNav
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void initBottomNav() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem("日报", R.drawable.ic_profile_answer, R.color.colorPrimary);
AHBottomNavigationItem item2 = new AHBottomNavigationItem("主题", R.drawable.ic_profile_article, R.color.colorPrimary);
AHBottomNavigationItem item3 = new AHBottomNavigationItem("专栏", R.drawable.ic_profile_column, R.color.colorPrimary);
AHBottomNavigationItem item4 = new AHBottomNavigationItem("文章", R.drawable.ic_profile_favorite, R.color.colorPrimary);
mAhBottomNavigation.addItem(item1);
mAhBottomNavigation.addItem(item2);
mAhBottomNavigation.addItem(item3);
mAhBottomNavigation.addItem(item4);
mAhBottomNavigation.setBehaviorTranslationEnabled(true);
mAhBottomNavigation.setAccentColor(getResources().getColor(R.color.colorPrimary));
mAhBottomNavigation.setInactiveColor(getResources().getColor(R.color.nav_text_color_mormal));
mAhBottomNavigation.setCurrentItem(0);
mAhBottomNavigation.setBehaviorTranslationEnabled(true);
mAhBottomNavigation.setDefaultBackgroundColor(getResources().getColor(R.color.bg_color));
mAhBottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {
@Override
public void onTabSelected(int position, boolean wasSelected) {
if (currentTabIndex != position) {//判断点击的position是不是当前显示的,不是就开启事务
FragmentTransaction trx = getSupportFragmentManager().beginTransaction();
trx.hide(fragments.get(currentTabIndex));//隐藏当前的Fragment,仅仅是设为不可见,并不会销毁
if (!fragments.get(position).isAdded()) {//判断position的fragment有没有添加到activity中
trx.add(R.id.content, fragments.get(position));
}
trx.show(fragments.get(position)).commit();//显示之前隐藏的Fragment
}
currentTabIndex = position;
}
});
}
示例7: setupViews
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void setupViews() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.tab_current_month, R.drawable.ic_whatshot, R.color.colorAccent);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.tab_last_month, R.drawable.ic_event, R.color.colorAccent);
AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.tab_all_time, R.drawable.ic_star, R.color.colorAccent);
bottomNavigation.addItem(item1);
bottomNavigation.addItem(item2);
bottomNavigation.addItem(item3);
bottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
bottomNavigation.setAccentColor(Color.parseColor(navigationColor));
bottomNavigation.setBehaviorTranslationEnabled(false);
}
示例8: setupViews
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void setupViews() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.tab_event_about, R.drawable.ic_about, R.color.colorAccent);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.tab_event_news, R.drawable.ic_activity, R.color.colorAccent);
bottomNavigation.addItem(item1);
bottomNavigation.addItem(item2);
bottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
bottomNavigation.setAccentColor(Color.parseColor(navigationColor));
bottomNavigation.setBehaviorTranslationEnabled(false);
}
示例9: prepareBottomView
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void prepareBottomView() {
bottomNavigation.setDefaultBackgroundColor(getResources().getColor(R.color.bottom_navigation_bg));
bottomNavigation.setAccentColor(getResources().getColor(R.color.cardContentTextColorWhite));
bottomNavigation.setForceTitlesDisplay(true);
bottomNavigation.addItem(new AHBottomNavigationItem(R.string.tab_title, R.drawable.ic_cloud_24dp, R.color.cardContentTextColorWhite));
bottomNavigation.addItem(new AHBottomNavigationItem(R.string.tab_plan_title, R.drawable.ic_place_24dp, R.color.cardContentTextColorWhite));
bottomNavigation.addItem(new AHBottomNavigationItem(R.string.tab_info_title, R.drawable.ic_error_outline_24dp, R.color.cardContentTextColorWhite));
}
示例10: setUpBottomNavigationBar
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void setUpBottomNavigationBar() {
int icon = R.drawable.ic_trending_up_black_24dp;
int backgroundColor = SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ?
R.color.trending_bottom_bar_background_light : R.color.trending_bottom_bar_background_dark;
int colorActive = R.color.trending_bottom_bar_active_light;
int colorInActive = R.color.trending_bottom_bar_inactive_light;
AHBottomNavigationItem daily = new AHBottomNavigationItem(R.string.trending_daily,
icon, backgroundColor);
AHBottomNavigationItem weekly = new AHBottomNavigationItem(R.string.trending_weekly,
icon, backgroundColor);
AHBottomNavigationItem monthly = new AHBottomNavigationItem(R.string.trending_monthly,
icon, backgroundColor);
mBottomNavigation.setVisibility(View.VISIBLE);
mBottomNavigation.removeAllItems();
mBottomNavigation.addItem(daily);
mBottomNavigation.addItem(weekly);
mBottomNavigation.addItem(monthly);
mBottomNavigation.setBehaviorTranslationEnabled(true);
mBottomNavigation.setColoredModeColors(getResources().getColor(colorActive),
getResources().getColor(colorInActive));
mBottomNavigation.setColored(true);
mBottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {
@Override
public boolean onTabSelected(int position, boolean wasSelected) {
mPresenter.onTabSelected(position);
return true;
}
});
}
示例11: addTabs
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
for (ScreenParams screenParams : params) {
AHBottomNavigationItem item = new AHBottomNavigationItem(screenParams.tabLabel, screenParams.tabIcon,
Color.GRAY);
addItem(item);
setOnTabSelectedListener(onTabSelectedListener);
}
setTitlesDisplayState();
}
示例12: addBottomNavigationItems
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
/**
* Adds (items) {@link AHBottomNavigationItem} to {@link AHBottomNavigation}
* Also assigns a distinct color to each Bottom Navigation item, used for the color ripple.
*/
private void addBottomNavigationItems() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.tab_1, R.drawable.ic_map_24dp, colors[0]);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.tab_2, R.drawable.ic_local_restaurant_24dp, colors[1]);
AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.tab_3, R.drawable.ic_store_mall_directory_24dp, colors[2]);
bottomNavigation.addItem(item1);
bottomNavigation.addItem(item2);
bottomNavigation.addItem(item3);
}
示例13: setupBottomBar
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void setupBottomBar() {
bottomNavigation = (AHBottomNavigation) findViewById(R.id.bottomBar);
// Create items
AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.nearby_bottom_navigation_home, R.drawable.ic_list_black_24dp, R.color.colorAccent);
AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.nearby_bottom_navigation_chat, R.drawable.ic_chat_bubble_outline_black_24dp, R.color.colorAccent);
AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.nearby_bottom_navigation_profile, R.drawable.ic_person_outline_black_24dp, R.color.colorAccent);
// Add items
bottomNavigation.addItem(item1);
bottomNavigation.addItem(item2);
bottomNavigation.addItem(item3);
bottomNavigation.setDefaultBackgroundColor(Color.parseColor("#FEFEFE"));
bottomNavigation.setCurrentItem(0);
bottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {
@Override
public boolean onTabSelected(int position, boolean wasSelected) {
switch (position) {
case 0:
mViewPager.setCurrentItem(0);
break;
case 1:
mViewPager.setCurrentItem(1);
Intent intent = new Intent(NearbyProductsActivity.this, GroupChannelActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.left_out, R.anim.right_in);
break;
case 2:
mViewPager.setCurrentItem(2);
break;
}
return true;
}
});
bottomNavigation.setOnNavigationPositionListener(new AHBottomNavigation.OnNavigationPositionListener() {
@Override
public void onPositionChange(int y) {
//Toast.makeText(mContext, "Change: " + y, Toast.LENGTH_SHORT).show();
}
});
}
示例14: initBottomNav
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
private void initBottomNav() {
AHBottomNavigationItem item1 = new AHBottomNavigationItem("主页",
R.drawable.ic_tab_home);
AHBottomNavigationItem item2 = new AHBottomNavigationItem("圈子",
R.drawable.ic_tab_quanzi);
AHBottomNavigationItem item3 = new AHBottomNavigationItem("社区",
R.drawable.ic_tab_community);
AHBottomNavigationItem item4 = new AHBottomNavigationItem("我的",
R.drawable.ic_tab_mine);
mAhBottomNavigation.addItem(item1);
mAhBottomNavigation.addItem(item2);
mAhBottomNavigation.addItem(item3);
mAhBottomNavigation.addItem(item4);
mAhBottomNavigation.setColored(false);
mAhBottomNavigation.setForceTint(false);
mAhBottomNavigation.setBehaviorTranslationEnabled(true);
mAhBottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
mAhBottomNavigation.setAccentColor(getResources().getColor(R.color.colorPrimaryDark));
mAhBottomNavigation.setInactiveColor(getResources().getColor(R.color.colorPrimaryDark));
mAhBottomNavigation.setCurrentItem(0);
mAhBottomNavigation.setDefaultBackgroundColor(
getResources().getColor(R.color.colorPrimary));
mAhBottomNavigation.setOnTabSelectedListener((position, wasSelected) -> {
if (currentTabIndex != position) {
FragmentTransaction trx = getSupportFragmentManager().beginTransaction();
trx.hide(fragments.get(currentTabIndex));
if (!fragments.get(position).isAdded()) {
trx.add(R.id.content, fragments.get(position));
}
trx.show(fragments.get(position)).commit();
}
currentTabIndex = position;
return true;
});
}
示例15: navigationItem
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem; //导入依赖的package包/类
public static NavigationItem navigationItem(int type, int titleRes, int iconRes, int colorRes) {
return new NavigationItem(type, new AHBottomNavigationItem(titleRes, iconRes, colorRes));
}