当前位置: 首页>>代码示例>>Java>>正文


Java BottomNavigationItem类代码示例

本文整理汇总了Java中com.ashokvarma.bottomnavigation.BottomNavigationItem的典型用法代码示例。如果您正苦于以下问题:Java BottomNavigationItem类的具体用法?Java BottomNavigationItem怎么用?Java BottomNavigationItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BottomNavigationItem类属于com.ashokvarma.bottomnavigation包,在下文中一共展示了BottomNavigationItem类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initBottomNavBar

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
private void initBottomNavBar() {

        BadgeItem badgeItem = new BadgeItem();
        badgeItem.setHideOnSelect(false)
                .setText("5")
                .setBackgroundColorResource(R.color.colorAccent)
                .setBorderWidth(0);

        mBottomNavBar.setMode(BottomNavigationBar.MODE_FIXED);
        mBottomNavBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC);
        mBottomNavBar.addItem(new BottomNavigationItem(R.drawable.ic_main_meipai_normal, R.string.tab_video)).setActiveColor(R.color.colorAccent)
                .addItem(new BottomNavigationItem(R.drawable.ic_main_focus_normal, R.string.tab_focus).setActiveColorResource(R.color.colorAccent))
                .addItem(new BottomNavigationItem(R.drawable.ic_main_meipai_normal, "拍拍拍")).setActiveColor(R.color.colorAccent)
                .addItem(new BottomNavigationItem(R.drawable.ic_main_channel_normal, R.string.tab_channel).setActiveColorResource(R.color.colorAccent))
                .addItem(new BottomNavigationItem(R.drawable.ic_main_personal_normal, R.string.tab_mine).setActiveColorResource(R.color.colorAccent).setBadgeItem(badgeItem))
                .setFirstSelectedPosition(0)
                .initialise();

        mBottomNavBar.setTabSelectedListener(this);
    }
 
开发者ID:NullUsera,项目名称:meipai-Android,代码行数:21,代码来源:MainActivity.java

示例2: initViews

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
@Override
protected void initViews(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    AccountManager.getInstance().checkLogin(this, true, false);

    mNavTabs = new String[]{App.getInstance().getString(R.string.nav_main_rooms),
            App.getInstance().getString(R.string.nav_main_mine),
            App.getInstance().getString(R.string.nav_main_person)};

    mIcons = new int[]{R.drawable.ic_home, R.drawable.ic_mine, R.drawable.ic_person};

    mBottomBar = findView(R.id.bnb_main);

    for (int i = 0; i < mNavTabs.length; i++) {
        mBottomBar.addItem(new BottomNavigationItem(mIcons[i], mNavTabs[i]).setActiveColor(R.color.bottom_bar_active));
    }
    mBottomBar.setFirstSelectedPosition(0).initialise();
    switchFragment(R.id.frame_main_content, mNavTabs[0], this);
}
 
开发者ID:inexistence,项目名称:VideoMeeting,代码行数:23,代码来源:MainActivity.java

示例3: initViews

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
@Override
protected void initViews() {
    mBottomNavBar
            .setMode(BottomNavigationBar.MODE_SHIFTING)
            .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE)
            .setBarBackgroundColor(R.color.main_color)
            .setInActiveColor(R.color.main_color)
            .setActiveColor(R.color.md_white_1000)
            .addItem(new BottomNavigationItem(R.drawable.menu_news, "新闻"))
            .addItem(new BottomNavigationItem(R.drawable.menu_photo, "美女"))
            .addItem(new BottomNavigationItem(R.drawable.menu_movie, "电影"))
            .addItem(new BottomNavigationItem(R.drawable.menu_video, "视频"))
            .addItem(new BottomNavigationItem(R.drawable.menu_mine, "我的"))
            .initialise();
    mBottomNavBar.setTabSelectedListener(new BottomNavigationBar.SimpleOnTabSelectedListener(){
        @Override
        public void onTabSelected(int position) {
            mCurrentItem = position;
            mHandler.sendEmptyMessage(MESSAGE_SWITCH_ITEM);
        }
    });

    mAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    vpContainer.setAdapter(mAdapter);
    vpContainer.setOffscreenPageLimit(3);
    vpContainer.setNoScroll(true);

}
 
开发者ID:lai233333,项目名称:MyDemo,代码行数:29,代码来源:MainActivity.java

示例4: initNavigation

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
private void initNavigation() {
    mBottomNavigation.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE)
            .setMode(BottomNavigationBar.MODE_SHIFTING)
            .addItem(new BottomNavigationItem(R.drawable.ic_home, getString(R.string.nav_00_title)).setActiveColorResource(R.color.colorPrimary))
            .addItem(new BottomNavigationItem(R.drawable.ic_view_headline, getString(R.string.nav_01_title)).setActiveColorResource(R.color.colorPrimary))
            .addItem(new BottomNavigationItem(R.drawable.ic_live_tv, getString(R.string.nav_02_title)).setActiveColorResource(R.color.colorPrimary))
            .setFirstSelectedPosition(0)
            .setTabSelectedListener(this)
            .initialise();
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:11,代码来源:MainActivity.java

示例5: initBottomBar

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
private void initBottomBar(Bundle savedInstanceState) {
    bottom_navigation_bar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);
    bottom_navigation_bar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC);
    bottom_navigation_bar.setMode(BottomNavigationBar.MODE_CLASSIC);
    bottom_navigation_bar
            //setBadgeItem(numberBadgeItem)
            .addItem(new BottomNavigationItem(R.drawable.bb_menu_lessons, getString(R.string.cap_bb_menu_lessons)).setActiveColorResource(R.color.flux_main_color))
            .addItem(new BottomNavigationItem(R.drawable.bb_menu_scheduled, getString(R.string.cap_bb_menu_scheduled)).setActiveColorResource(R.color.flux_main_color))
            .addItem(new BottomNavigationItem(R.drawable.bb_menu_discover, getString(R.string.cap_bb_menu_discover)).setActiveColorResource(R.color.flux_main_color))
            .addItem(new BottomNavigationItem(R.drawable.bb_menu_me, getString(R.string.cap_bb_menu_me)).setActiveColorResource(R.color.flux_main_color))
            .setFirstSelectedPosition(0)
            .initialise();
}
 
开发者ID:kituri,项目名称:KituriFlux,代码行数:14,代码来源:MainActivity.java

示例6: loadData

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
@Override
protected void loadData() {
    bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED);
    bottomNavigationBar
            .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC
            );
    bottomNavigationBar.addItem(new BottomNavigationItem(R.drawable.ic_picture, "图片").setActiveColorResource(R.color.picture_color))
            .addItem(new BottomNavigationItem(R.drawable.ic_news, "新闻").setActiveColorResource(R.color.news_color))
            .addItem(new BottomNavigationItem(R.drawable.ic_my, "我的").setActiveColorResource(R.color.my_color))
            .setFirstSelectedPosition(0)
            .initialise();
    fragments = getFragments();
    setDefaultFragment();
    bottomNavigationBar.setTabSelectedListener(this);
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:16,代码来源:MainActivity.java

示例7: initBottomBar

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
private void initBottomBar() {
    bottomNavigationBar
            .addItem(new BottomNavigationItem(R.mipmap.meizhi,R.string.meizhi))
            .addItem(new BottomNavigationItem(R.mipmap.classify,R.string.history))
            .addItem(new BottomNavigationItem(R.mipmap.mine,R.string.mine))
            .initialise();
    bottomNavigationBar.setTabSelectedListener(this) ;
    onTabSelected(0) ;
}
 
开发者ID:yeming1001,项目名称:GankMeiZhi,代码行数:10,代码来源:MainActivity.java

示例8: setUpBottomNavBar

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
private void setUpBottomNavBar() {
  bottomNavBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
  bottomNavBar
      .addItem(new BottomNavigationItem(R.drawable.ic_search_24dp, R.string.search))
      .addItem(new BottomNavigationItem(R.drawable.ic_favorite_24dp, R.string.favorites))
      .addItem(new BottomNavigationItem(R.drawable.ic_profile_24dp, R.string.profile))
      .initialise();
  bottomNavBar.setTabSelectedListener(this);
}
 
开发者ID:JetradarMobile,项目名称:android-multibackstack,代码行数:10,代码来源:MainActivity.java

示例9: refresh

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
private void refresh() {

        bottomNavigationBar.clearAll();
//        bottomNavigationBar.setFab(fabHome, BottomNavigationBar.FAB_BEHAVIOUR_TRANSLATE_AND_STICK);
        bottomNavigationBar.setFab(fabHome);

        setScrollableText(lastSelectedPosition);

        numberBadgeItem = new TextBadgeItem()
                .setBorderWidth(4)
                .setBackgroundColorResource(R.color.blue)
                .setText("" + lastSelectedPosition)
                .setHideOnSelect(autoHide.isChecked());

        shapeBadgeItem = new ShapeBadgeItem()
                .setShape(shapeSpinner.getSelectedItemPosition())
                .setShapeColorResource(R.color.teal)
                .setGravity(Gravity.TOP | Gravity.END)
                .setHideOnSelect(autoHide.isChecked());

        bottomNavigationBar.setMode(modeSpinner.getSelectedItemPosition());
        bottomNavigationBar.setBackgroundStyle(bgSpinner.getSelectedItemPosition());


        if (itemSpinner.getSelectedItemPosition() == 0) {
            bottomNavigationBar
                    .addItem(new BottomNavigationItem(R.drawable.ic_location_on_white_24dp, "Nearby").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
                    .addItem(new BottomNavigationItem(R.drawable.ic_find_replace_white_24dp, "Find").setActiveColorResource(R.color.teal))
                    .addItem(new BottomNavigationItem(R.drawable.ic_favorite_white_24dp, "Categories").setActiveColorResource(R.color.blue).setBadgeItem(shapeBadgeItem))
                    .setFirstSelectedPosition(lastSelectedPosition > 2 ? 2 : lastSelectedPosition)
                    .initialise();
        } else if (itemSpinner.getSelectedItemPosition() == 1) {
            bottomNavigationBar
                    .addItem(new BottomNavigationItem(R.drawable.ic_home_white_24dp, "Home").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
                    .addItem(new BottomNavigationItem(R.drawable.ic_book_white_24dp, "Books").setActiveColorResource(R.color.teal))
                    .addItem(new BottomNavigationItem(R.drawable.ic_music_note_white_24dp, "Music").setActiveColorResource(R.color.blue).setBadgeItem(shapeBadgeItem))
                    .addItem(new BottomNavigationItem(R.drawable.ic_tv_white_24dp, "Movies & TV").setActiveColorResource(R.color.brown))
                    .setFirstSelectedPosition(lastSelectedPosition > 3 ? 3 : lastSelectedPosition)
                    .initialise();
        } else if (itemSpinner.getSelectedItemPosition() == 2) {
            bottomNavigationBar
                    .addItem(new BottomNavigationItem(R.drawable.ic_home_white_24dp, "Home").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
                    .addItem(new BottomNavigationItem(R.drawable.ic_book_white_24dp, "Books").setActiveColorResource(R.color.teal))
                    .addItem(new BottomNavigationItem(R.drawable.ic_music_note_white_24dp, "Music").setActiveColorResource(R.color.blue).setBadgeItem(shapeBadgeItem))
                    .addItem(new BottomNavigationItem(R.drawable.ic_tv_white_24dp, "Movies & TV").setActiveColorResource(R.color.brown))
                    .addItem(new BottomNavigationItem(R.drawable.ic_videogame_asset_white_24dp, "Games").setActiveColorResource(R.color.grey))
                    .setFirstSelectedPosition(lastSelectedPosition)
                    .initialise();
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:HomeActivityJava.java

示例10: onCreate

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    adapter = new MainViewAdapter(this);

    pager = (RecyclerView) findViewById(R.id.main_view_pager);
    pager.setHasFixedSize(true);
    pager.setLayoutManager(new NonScrollingHorizontalLayoutManager(this));
    pager.setAdapter(adapter);

    // Without this, the focus is completely busted on pre 15 devices. Trying to use them
    // without this ends up with each child view showing for a fraction of a second, then
    // reverting back to the "Latest" screen again, in completely non-deterministic ways.
    if (Build.VERSION.SDK_INT <= 15) {
        pager.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
    }

    updatesBadge = new BadgeItem().hide(false);

    bottomNavigation = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
    bottomNavigation.setTabSelectedListener(this)
            .setBarBackgroundColor(getBottomNavigationBackgroundColorResId())
            .setInActiveColor(R.color.bottom_nav_items)
            .setActiveColor(android.R.color.white)
            .setMode(BottomNavigationBar.MODE_FIXED)
            .addItem(new BottomNavigationItem(R.drawable.ic_latest, R.string.main_menu__latest_apps))
            .addItem(new BottomNavigationItem(R.drawable.ic_categories, R.string.main_menu__categories))
            .addItem(new BottomNavigationItem(R.drawable.ic_nearby, R.string.main_menu__swap_nearby))
            .addItem(new BottomNavigationItem(R.drawable.ic_updates, R.string.updates).setBadgeItem(updatesBadge))
            .addItem(new BottomNavigationItem(R.drawable.ic_settings, R.string.menu_settings))
            .initialise();

    IntentFilter updateableAppsFilter = new IntentFilter(AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED);
    updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED);
    updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED);
    LocalBroadcastManager.getInstance(this).registerReceiver(onUpdateableAppsChanged, updateableAppsFilter);

    if (savedInstanceState != null) {
        selectedMenuId = savedInstanceState.getInt(STATE_SELECTED_MENU_ID, R.id.whats_new);
    }
    setSelectedMenuInNav();

    initialRepoUpdateIfRequired();

    Intent intent = getIntent();
    handleSearchOrAppViewIntent(intent);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:52,代码来源:MainActivity.java

示例11: onCreate

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //TODO:百度统计初始化
        StatService.setSessionTimeOut(30);  //两次启动应用30s视为第二次启动
        StatService.setLogSenderDelayed(0); //崩溃后延迟0秒发送崩溃日志

        /** 代码方式添加广告,如果您使用XML配置方式添加广告,不需要以下代码 **/
//        AdsMogoLayout adsMogoLayoutCode = new AdsMogoLayout(this, "253352909fb3459babbff4adc49ca4ab");
//        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
//        //设置广告出现的位置(悬浮于底部)
//        params.bottomMargin = 0;
//        adsMogoLayoutCode.setAdsMogoListener(new AdsMogoListener() {
//            @Override
//            public void onInitFinish() {}
//            @Override
//            public void onRequestAd(String s) {}
//            @Override
//            public void onRealClickAd() {}
//            @Override
//            public void onReceiveAd(ViewGroup viewGroup, String s) {}
//            @Override
//            public void onFailedReceiveAd() {}
//            @Override
//            public void onClickAd(String s) {}
//            @Override
//            public boolean onCloseAd() {return false;}
//            @Override
//            public void onCloseMogoDialog() {}
//            @Override
//            public Class getCustomEvemtPlatformAdapterClass(AdsMogoCustomEventPlatformEnum adsMogoCustomEventPlatformEnum) {return null;}
//        });
//        params.gravity = Gravity.BOTTOM;
//        addContentView(adsMogoLayoutCode,params);
        /***********************         代码添加广告结束         ************************/

        BottomNavigationBar bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);
        bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED);
        bottomNavigationBar
                .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC
                );

        bottomNavigationBar.addItem(new BottomNavigationItem(R.mipmap.ic_home_white_24dp, R.string.newMovie).setActiveColorResource(R.color.orange))
                .addItem(new BottomNavigationItem(R.mipmap.ic_find_replace_white_24dp, R.string.search).setActiveColorResource(R.color.teal))
                .addItem(new BottomNavigationItem(R.mipmap.ic_setting, R.string.setting).setActiveColorResource(R.color.blue))
                .setFirstSelectedPosition(0)
                .initialise();

        fragments = getFragments();
        setDefaultFragment();
        bottomNavigationBar.setTabSelectedListener(this);
    }
 
开发者ID:yanweijia,项目名称:dytt,代码行数:55,代码来源:MainActivity.java

示例12: onCreate

import com.ashokvarma.bottomnavigation.BottomNavigationItem; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fresco.initialize(this);
        setContentView(R.layout.activity_main);
        mToolBar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolBar);

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, mToolBar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
        mFgTransaction = getSupportFragmentManager().beginTransaction();

        mBottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);

        mBottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE);
        mBottomNavigationBar
                .setActiveColor(R.color.colorPrimary)
                .setInActiveColor("#FFFFFF")
                .setBarBackgroundColor("#ECECEC");
        mBottomNavigationBar
                .addItem(new BottomNavigationItem(R.drawable.ic_home_white_24dp, "Home"))
                .addItem(new BottomNavigationItem(R.drawable.ic_tag_faces_white_24dp, "福利")).setActiveColor("#03A9F4")
                .addItem(new BottomNavigationItem(R.drawable.ic_android_white_24dp, "Android").setActiveColor("#00BCD4"))
                .addItem(new BottomNavigationItem(R.drawable.ic_phone_iphone_white_24dp, "iOS").setActiveColor("#009688"))
//                .addItem(new BottomNavigationItem(R.drawable.ic_android_white_24dp, "Games").setActiveColor("#3f51b5"))
                .initialise();
        mBottomNavigationBar.setTabSelectedListener(mOnTabSelectedListener);

        if (savedInstanceState == null) {
            mHomeFragment = new GankFragment();
            Bundle args = new Bundle();
            args.putString("type", "all");
            mHomeFragment.setArguments(args);
            mFgTransaction.add(R.id.root, mHomeFragment);
//            mFgTransaction.addToBackStack(null);
            mFgTransaction.commit();
        }
    }
 
开发者ID:lbytedev,项目名称:RetrofitRxJavaGank,代码行数:45,代码来源:MainActivity.java


注:本文中的com.ashokvarma.bottomnavigation.BottomNavigationItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。