當前位置: 首頁>>代碼示例>>Java>>正文


Java BottomBar.setOnTabSelectListener方法代碼示例

本文整理匯總了Java中com.roughike.bottombar.BottomBar.setOnTabSelectListener方法的典型用法代碼示例。如果您正苦於以下問題:Java BottomBar.setOnTabSelectListener方法的具體用法?Java BottomBar.setOnTabSelectListener怎麽用?Java BottomBar.setOnTabSelectListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.roughike.bottombar.BottomBar的用法示例。


在下文中一共展示了BottomBar.setOnTabSelectListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initView

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
private void initView() {
    mToolBar= (Toolbar) findViewById(R.id.common_toolbar);
    mBottomBar= (BottomBar) findViewById(R.id.bottomBar );
    mVpContent = (ViewPager) findViewById(R.id.vp_main_content);
    mBottomBar.setOnTabSelectListener(new OnTabSelectListener() {
        @Override
        public void onTabSelected(@IdRes int tabId) {
            switch (tabId) {
                case R.id.tab_home:
                    mToolBar.setTitle("飛鴿");
                    mVpContent.setCurrentItem(0);
                    break;
                case R.id.tab_tools:
                    mToolBar.setTitle("發現");
                    mVpContent.setCurrentItem(1);
                    break;
                case R.id.tab_person:
                    mToolBar.setTitle("我");
                    mVpContent.setCurrentItem(2);
                    break;

            }
        }
    });
}
 
開發者ID:monsterLin,項目名稱:Pigeon,代碼行數:26,代碼來源:MainActivity.java

示例2: onCreate

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_three_tabs_quick_return);

    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);

    // We're doing nothing with this listener here this time. Check example usage
    // from ThreeTabsActivity on how to use it.
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
        @Override
        public void onTabSelected(@IdRes int tabId) {

        }
    });
}
 
開發者ID:roughike,項目名稱:BottomBar,代碼行數:17,代碼來源:ThreeTabsQRActivity.java

示例3: onCreate

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbarColorAnimator = new ToolbarColorAnimator(toolbar, Color.BLACK);

    topLevelTabs = new SparseArray<>();
    topLevelTabs.put(R.id.tab_dining, new DiningTab());
    topLevelTabs.put(R.id.tab_restaurants, new RestaurantsTab());
    topLevelTabs.put(R.id.tab_settings, new SettingsTab());

    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(this);
}
 
開發者ID:sargunv,項目名稱:purdue-dining-courts-android,代碼行數:18,代碼來源:MainActivity.java

示例4: initListener

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
public void initListener() {
    bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
        @Override
        public void onTabSelected(@IdRes int tabId) {
            switch (tabId) {
                case R.id.tab1:
                    replaceFragment(new MusicFragment());
                    break;
                case R.id.tab2:
                    replaceFragment(new VideoHomeFragment());
                    break;
                case R.id.tab3:
                    replaceFragment(new HomeFragment());
                    break;
                case R.id.tab4:
                    replaceFragment(new MeFragment());

            }
        }
    });

    mFabMusic.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            LogUtils.d("MainActivity", "mFabMusic to startActivity");
            startActivity(new Intent(MainActivty.this, PlayMusicActivity.class));
        }
    });
    mFabMusic.setVisibility(View.GONE);

}
 
開發者ID:popo1379,項目名稱:popomusic,代碼行數:34,代碼來源:MainActivty.java

示例5: initializeBottomBar

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
/**
 * set up the navigation tabs at the bottom of the screen
 * navigation items:
 *      dashboard
 *      search
 *      add new habit
 *      follow requests
 *      profile
 */
private void initializeBottomBar() {
    bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
        @Override
        public void onTabSelected(@IdRes int tabId) {
            switch (tabId) {
                case R.id.tab_dashboard:
                    onDashboardClicked();
                    break;
                case R.id.tab_search:
                    onSearchClicked();
                    break;
                case R.id.tab_addHabit:
                    break;
                case R.id.tab_followRequests:
                    onFollowRequestClicked();
                    break;
                case R.id.tab_profile:
                    onProfileClicked();
                    break;
            }
        }
    });

    bottomBar.setTabSelectionInterceptor(new TabSelectionInterceptor() {
        @Override
        public boolean shouldInterceptTabSelection(@IdRes int oldTabId, @IdRes int newTabId) {
            if (newTabId == R.id.tab_addHabit) {
                onAddHabitClicked();
                return true;
            }
            return false;
        }
    });
}
 
開發者ID:CMPUT301F17T15,項目名稱:CIA,代碼行數:45,代碼來源:HomeTabbedActivity.java

示例6: setupBottomBar

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
private void setupBottomBar(BottomBar bottomBar) {
    bottomBar.setOnTabSelectListener(id -> {
        Fragment frag = null;

        switch (id) {
            case R.id.tab_map:
                if (awaitingLocationPermission) {
                    frag = new MapPlaceHolderFragment();
                } else {
                    frag = new MapboxMapFragment();
                }
                break;

            case R.id.tab_now:
                frag = new ExploreListViewFragment();
                break;

            case R.id.tab_browse:
                frag = new BrowseListViewFragment();
                break;

            case R.id.tab_favorites:
                frag = new FavoritesListViewFragment();
                break;
        }

        if (frag != null) {
            setCurrentFragment(frag);
        }
    });
}
 
開發者ID:Burning-Man-Earth,項目名稱:iBurn-Android,代碼行數:32,代碼來源:MainActivity.java

示例7: onCreate

import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fresco.initialize(this);
    setContentView(R.layout.activity_main);
    LibF = new LibraryFragment();
    PopF = new PopularFragment();
    BroF = new BrowseFragment();
    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
        @Override
        public void onTabSelected(@IdRes int menuItemId) {
            // The user selected a tab at the specified position
            FragmentTransaction FragTrans = FragMan.beginTransaction();
            if (menuItemId == R.id.menu_library) {

                FragTrans.replace(R.id.MainLayout, LibF);
            } else if (menuItemId == R.id.menu_popular) {

                FragTrans.replace(R.id.MainLayout, PopF);
            } else if (menuItemId == R.id.menu_browse) {

                FragTrans.replace(R.id.MainLayout, BroF);
            }
            FragTrans.commit();
        }

    });
    RequestQueue queue = MySingleton.getInstance(this.getApplicationContext()).
            getRequestQueue();
    popularMangaList = new ArrayList<>();
    newMangaList = new ArrayList<>();

    //TODO : Caching Popular mangalist
    //TODO : Implementing ThreadPool for concurrent mangalist fetch
    Intent mangaFetch = new Intent(this,MangaFetchService.class);
    mangaFetch.putExtra("mangaURL",mangaFox);
    mangaFetch.putExtra("receiver",new PopularProgress(new Handler()));
    this.startService(mangaFetch);

}
 
開發者ID:FR0ST1N,項目名稱:Mataku,代碼行數:42,代碼來源:MainActivity.java


注:本文中的com.roughike.bottombar.BottomBar.setOnTabSelectListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。