com.google.android.material.tabs.TabLayout Java Examples
The following examples show how to use
com.google.android.material.tabs.TabLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GiphyActivity.java From mollyim-android with GNU General Public License v3.0 | 7 votes |
private void initializeResources() { ViewPager viewPager = ViewUtil.findById(this, R.id.giphy_pager); TabLayout tabLayout = ViewUtil.findById(this, R.id.tab_layout); this.gifFragment = new GiphyGifFragment(); this.stickerFragment = new GiphyStickerFragment(); this.forMms = getIntent().getBooleanExtra(EXTRA_IS_MMS, false); gifFragment.setClickListener(this); stickerFragment.setClickListener(this); viewPager.setAdapter(new GiphyFragmentPagerAdapter(this, getSupportFragmentManager(), gifFragment, stickerFragment)); tabLayout.setupWithViewPager(viewPager); tabLayout.setBackgroundColor(getConversationColor()); }
Example #2
Source File: MaleFemalePresenter.java From Autocomplete with Apache License 2.0 | 6 votes |
@NonNull @Override protected ViewGroup getView() { // RecyclerViewPresenter returns a RecyclerView. We inflate it in a bigger container. ViewGroup rv = super.getView(); ViewGroup container = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.male_female_popup, null); // Add RecyclerView to our container ViewGroup rvContainer = container.findViewById(R.id.recycler_view_container); rvContainer.addView(rv, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // Set up bar that reacts to clicks and syncs with 'females' boolean TabLayout tabLayout = container.findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("Males")); tabLayout.addTab(tabLayout.newTab().setText("Females")); //noinspection ConstantConditions tabLayout.getTabAt(females ? 1 : 0).select(); tabLayout.addOnTabSelectedListener(this); return container; }
Example #3
Source File: TabLayoutActions.java From material-components-android with Apache License 2.0 | 6 votes |
/** Wires <code>TabLayout</code> to <code>ViewPager</code> content. */ public static ViewAction setupWithViewPager( final @Nullable ViewPager viewPager, final boolean autoRefresh) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return isDisplayingAtLeast(90); } @Override public String getDescription() { return "Setup with ViewPager content"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); TabLayout tabLayout = (TabLayout) view; tabLayout.setupWithViewPager(viewPager, autoRefresh); uiController.loopMainThreadUntilIdle(); } }; }
Example #4
Source File: DynamicViewPager2Fragment.java From dynamic-support with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (getActivity() == null) { return; } ((DynamicActivity) requireActivity()).addHeader(R.layout.ads_tabs, true); mTabLayout = requireActivity().findViewById(R.id.ads_tab_layout); mViewPager.setOffscreenPageLimit(getItemCount()); mViewPager.setAdapter(new ViewPagerAdapter(this, this)); new TabLayoutMediator(mTabLayout, mViewPager, new TabLayoutMediator.TabConfigurationStrategy() { @Override public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) { tab.setText(getTitle(position)); } }).attach(); if (getArguments() != null && requireArguments().containsKey(ADS_ARGS_VIEW_PAGER_PAGE)) { setPage(requireArguments().getInt(ADS_ARGS_VIEW_PAGER_PAGE)); } }
Example #5
Source File: MainActivity.java From HaoReader with GNU General Public License v3.0 | 6 votes |
private void setCustomView(TabLayout.Tab tab) { if (tab == null) return; @SuppressLint("InflateParams") View view = getLayoutInflater().inflate(R.layout.item_home_tab, null); TextView text = view.findViewById(R.id.text); ImageView icon = view.findViewById(R.id.icon); text.setText(tab.getText()); text.setTag(text.getCurrentTextColor()); icon.setImageDrawable(tab.getIcon()); icon.setTag(tab.getIcon()); tab.setCustomView(view); if (tab.getCustomView() != null) { View tabView = (View) tab.getCustomView().getParent(); tabView.setOnLongClickListener(v -> whenTabLongClick(tab)); } }
Example #6
Source File: StatisticsFragment.java From privacy-friendly-interval-timer with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_statistics, container, false); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { //actionBar.setSubtitle(R.string.action_main); actionBar.setDisplayHomeAsUpEnabled(true); } container.removeAllViews(); ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager); setupViewPager(viewPager); TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); setHasOptionsMenu(true); return view; }
Example #7
Source File: MainActivity.java From SimpleSearchView with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); searchView = findViewById(R.id.searchView); tabLayout = findViewById(R.id.tabLayout); SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); ViewPager viewPager = findViewById(R.id.container); viewPager.setAdapter(sectionsPagerAdapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager)); }
Example #8
Source File: TabLayoutActions.java From material-components-android with Apache License 2.0 | 6 votes |
/** Sets the specified tab mode in the <code>TabLayout</code>. */ public static ViewAction setTabMode(final int tabMode) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return isDisplayingAtLeast(90); } @Override public String getDescription() { return "Sets tab mode"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); TabLayout tabLayout = (TabLayout) view; tabLayout.setTabMode(tabMode); uiController.loopMainThreadUntilIdle(); } }; }
Example #9
Source File: TravelTimePicker.java From msdkui-android with Apache License 2.0 | 6 votes |
private void updateTab(final Bundle savedInstanceState) { if (mTabLayout == null) { return; } mTabLayout.setVisibility(View.VISIBLE); int type = mTimeType.value(); if (savedInstanceState != null) { type = savedInstanceState.getInt(TAB_SELECTED); } final TabLayout.Tab tab = mTabLayout.getTabAt(type); if (tab != null) { tab.select(); } if (mVariety != Variety.BOTH) { mTabLayout.setVisibility(View.GONE); } }
Example #10
Source File: CPUBoostActivity.java From SmartPack-Kernel-Manager with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tablayout); TabLayout tabLayout = findViewById(R.id.tabLayoutID); ViewPager viewPager = findViewById(R.id.viewPagerID); PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager()); if (CPUBoost.getInstance().supported() || CPUInputBoost.getInstance().supported()) { adapter.AddFragment(new CPUBoostFragment(), getString(R.string.cpu_boost)); } if (VoxPopuli.hasVoxpopuliTunable()) { adapter.AddFragment(new PowerHalFragment(), getString(R.string.powerhal)); } if (StuneBoost.supported()) { adapter.AddFragment(new StuneBoostFragment(), getString(R.string.stune_boost)); } viewPager.setAdapter(adapter); tabLayout.setVisibility(View.VISIBLE); ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) viewPager.getLayoutParams(); lp.bottomMargin += 150; tabLayout.setupWithViewPager(viewPager); }
Example #11
Source File: SelectAppActivity.java From Taskbar with Apache License 2.0 | 6 votes |
@Override protected void onPostExecute(AppListAdapter[] adapters) { hiddenAdapter = adapters[U.HIDDEN]; topAppsAdapter = adapters[U.TOP_APPS]; SelectAppPagerAdapter pagerAdapter = new SelectAppPagerAdapter(getSupportFragmentManager()); ViewPager viewPager = findViewById(R.id.pager); viewPager.setAdapter(pagerAdapter); TabLayout tabLayout = findViewById(R.id.sliding_tabs); tabLayout.setupWithViewPager(viewPager); findViewById(R.id.configure_start_menu_layout).setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); setFinishOnTouchOutside(true); }
Example #12
Source File: MainActivity.java From HaoReader with GNU General Public License v3.0 | 6 votes |
private void whenTabReselected(TabLayout.Tab tab) { FragmentTrigger fragmentTrigger = null; switch (tab.getPosition()) { case 0: fragmentTrigger = findFragment(MainBookListFragment.class); break; case 1: fragmentTrigger = findFragment(FindBookFragment.class); break; case 2: fragmentTrigger = findFragment(AudioBookFragment.class); } if (fragmentTrigger != null) { fragmentTrigger.onReselected(); } }
Example #13
Source File: TabBubbleAnimator.java From bubble-icon-tabbar-android with MIT License | 6 votes |
private void getTabView(int position, TabLayout.Tab tab, boolean isSelected) { View view = tab.getCustomView() == null ? LayoutInflater.from(tabLayout.getContext()).inflate(R.layout.custom_tab, null) : tab.getCustomView(); if (tab.getCustomView() == null) { tab.setCustomView(view); } ImageView bg = view.findViewById(R.id.bg); bg.setVisibility(isSelected ? VISIBLE : INVISIBLE); TextView tabTextView = view.findViewById(R.id.tabTextView); tabTextView.setTextColor(isSelected ? getColor(mFragmentColorList.get(position)) : unselectedColorId); tabTextView.setVisibility(isSelected ? VISIBLE : GONE); ImageView tabImageView = view.findViewById(R.id.tabImageView); tabImageView.setImageResource(mFragmentIconList.get(position)); tabImageView.setColorFilter(isSelected ? getColor(mFragmentColorList.get(position)) : unselectedColorId, PorterDuff.Mode.SRC_ATOP); if (isSelected) { bg.setColorFilter(ContextCompat.getColor(tabLayout.getContext(), mFragmentColorList.get(position)), PorterDuff.Mode.SRC_ATOP); bg.setAlpha(0.2f); tabTextView.setText(mFragmentTitleList.get(position)); } }
Example #14
Source File: ViewsActivity.java From AndroidAnimationExercise with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_views); mFragments.add(new CircleMenuFragment()); tabs.add("环形菜单"); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.setupWithViewPager(mViewPager); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); }
Example #15
Source File: TeiDashboardMobileActivity.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void setupTabletTabTitles(TabLayout.Tab tab, int position) { if (programUid != null) { switch (position) { case INDICATORS_LANDSCAPE_POS: tab.setText(getString(R.string.dashboard_indicators)); break; case RELATIONSHIPS_LANDSCAPE_POS: tab.setText(getString(R.string.dashboard_relationships)); break; case NOTES_LANDSCAPE_POS: tab.setText(getString(R.string.dashboard_notes)); break; default: break; } } }
Example #16
Source File: MyMusicFragment.java From odyssey with GNU General Public License v3.0 | 6 votes |
/** * Called when a tab enters the selected state. */ @Override public void onTabSelected(TabLayout.Tab tab) { // set viewpager to current page mMyMusicViewPager.setCurrentItem(tab.getPosition()); if (mToolbarAndFABCallback != null) { // show fab only for AllTracksFragment View.OnClickListener listener = getPlayButtonListener(tab.getPosition()); // set up play button mToolbarAndFABCallback.setupFAB(listener); } // force to recreate the optionsmenu getActivity().invalidateOptionsMenu(); OdysseyFragment fragment = mMyMusicPagerAdapter.getRegisteredFragment(tab.getPosition()); if (fragment != null) { fragment.getContent(); // Disable memory trimming to prevent removing the shown data fragment.enableMemoryTrimming(false); } }
Example #17
Source File: TabLayoutMediator.java From PhoneProfilesPlus with Apache License 2.0 | 6 votes |
@SuppressWarnings("WeakerAccess") void populateTabsFromPagerAdapter() { mTabLayout.removeAllTabs(); if (mAdapter != null) { int adapterCount = mAdapter.getItemCount(); for (int i = 0; i < adapterCount; i++) { TabLayout.Tab tab = mTabLayout.newTab(); mOnConfigureTabCallback.onConfigureTab(tab, i); mTabLayout.addTab(tab, false); } // Make sure we reflect the currently set ViewPager item if (adapterCount > 0) { int currItem = mViewPager.getCurrentItem(); if (currItem != mTabLayout.getSelectedTabPosition()) { //noinspection ConstantConditions mTabLayout.getTabAt(currItem).select(); } } } }
Example #18
Source File: TabLayoutActions.java From material-components-android with Apache License 2.0 | 6 votes |
/** Setup and show badge number for the specified tab of the <code>TabLayout</code>. */ public static ViewAction showBadgeOnTab(final int tabIndex, final int badgeNumber) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return isDisplayingAtLeast(90); } @Override public String getDescription() { return "Setup tab badge number"; } @Override public void perform(UiController uiController, View view) { TabLayout tabLayout = (TabLayout) view; tabLayout.getTabAt(tabIndex).getOrCreateBadge().setNumber(badgeNumber); } }; }
Example #19
Source File: NavigationDrawerFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 6 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { Toolbar toolbar = view.findViewById(R.id.toolbar); setupToolbar(toolbar); initDrawerLayout(view, toolbar); initNavigationView(view); mViewPager = view.findViewById(R.id.pager); TabLayout tabLayout = view.findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); super.onViewCreated(view, savedInstanceState); mPresenter.loadBoardInfo(); }
Example #20
Source File: TravelTimePickerTest.java From msdkui-android with Apache License 2.0 | 5 votes |
@Test public void clickingOkShouldGiveCurrentTimeAndType() { final Calendar currentCalendar = Calendar.getInstance(); mTravelTimePicker.open(getSupportFragmentManager()); mTravelTimePicker.setOnTimePickedListener(new TravelTimePickerOnTimePickedListener(currentCalendar, RouteOptions.TimeType.ARRIVAL)); final Dialog dialog = mTravelTimePicker.getDialog(); ((TabLayout) dialog.findViewById(R.id.picker_tab)).getTabAt(1).select(); // click on arrival ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE).performClick(); // click on date ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE).performClick(); // click on time }
Example #21
Source File: MainActivity.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
/** * 更新Tab文字 */ private void updateTabItemText(int group) { TabLayout.Tab tab = mTlIndicator.getTabAt(0); if (tab == null) return; View customView = tab.getCustomView(); if (customView == null) return; TextView tv = customView.findViewById(R.id.tabtext); tv.setText(getResources().getStringArray(R.array.book_group_array)[group]); tab.setContentDescription(String.format("%s,%s", tv.getText(), getString(R.string.click_on_selected_show_menu))); }
Example #22
Source File: TransportModePanel.java From msdkui-android with Apache License 2.0 | 5 votes |
/** * Sets the {@link com.here.android.mpa.routing.RouteOptions.TransportMode} * that should be selected. * @param transportMode the {@link com.here.android.mpa.routing.RouteOptions.TransportMode} * to be selected. */ public void setSelectedTransportMode(final RouteOptions.TransportMode transportMode) { final TabLayout.Tab tab = mTabLayout.getTabAt(mPanelAdapter.getTransportModes().indexOf(transportMode)); if (tab != null) { tab.select(); } }
Example #23
Source File: MyHelperAdapter.java From MultiTypeRecyclerViewAdapter with Apache License 2.0 | 5 votes |
private void renderFoot(BaseViewHolder helper) { if (mContext instanceof FragmentActivity) { FragmentActivity activity = (FragmentActivity) mContext; TextView title = helper.getTextView(R.id.title); title.setText("为您精选"); TabLayout tab = helper.getView(R.id.footer_tab, TabLayout.class); ViewPager pager = helper.getView(R.id.footer_pager, ViewPager.class); pager.setAdapter(new FooterVPAdapter(activity.getSupportFragmentManager())); tab.setupWithViewPager(pager); } }
Example #24
Source File: StickerSelectActivity.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.scribble_select_sticker_activity); ViewPager viewPager = findViewById(R.id.camera_sticker_pager); viewPager.setAdapter(new StickerPagerAdapter(getSupportFragmentManager(), this)); TabLayout tabLayout = findViewById(R.id.camera_sticker_tabs); tabLayout.setupWithViewPager(viewPager); for (int i=0;i<tabLayout.getTabCount();i++) { tabLayout.getTabAt(i).setIcon(TAB_TITLES[i]); } }
Example #25
Source File: ItemPagerAdapter.java From materialistic with Apache License 2.0 | 5 votes |
public void bind(ViewPager viewPager, TabLayout tabLayout, FloatingActionButton navigationFab, FloatingActionButton genericFab) { viewPager.setPageMargin(viewPager.getResources().getDimensionPixelOffset(R.dimen.divider)); viewPager.setPageMarginDrawable(R.color.blackT12); viewPager.setOffscreenPageLimit(2); viewPager.setAdapter(this); tabLayout.setupWithViewPager(viewPager); mTabListener = new TabLayout.ViewPagerOnTabSelectedListener(viewPager) { @Override public void onTabSelected(TabLayout.Tab tab) { super.onTabSelected(tab); toggleFabs(viewPager.getCurrentItem() == 0, navigationFab, genericFab); Fragment fragment = getItem(viewPager.getCurrentItem()); if (fragment != null) { ((LazyLoadFragment) fragment).loadNow(); } } @Override public void onTabReselected(TabLayout.Tab tab) { Fragment fragment = getItem(viewPager.getCurrentItem()); if (fragment != null) { ((Scrollable) fragment).scrollToTop(); } } }; tabLayout.addOnTabSelectedListener(mTabListener); viewPager.setCurrentItem(mDefaultItem); toggleFabs(mDefaultItem == 0, navigationFab, genericFab); }
Example #26
Source File: TabLayoutAssist.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 设置选中 * @param position 选中索引 * @param isScroll 是否滑动 * @return {@link TabLayoutAssist} */ public TabLayoutAssist setSelect(int position, boolean isScroll) { try { TabLayout.Tab tab = tabLayout.getTabAt(position); tab.select(); // 切换选中状态 updateTabTextView(tab, true); } catch (Exception e) { } // 滑动处理 if (isScroll) scrollTab(getSelectedTabPosition()); return this; }
Example #27
Source File: BaseActivity.java From Infinity-For-Reddit with GNU Affero General Public License v3.0 | 5 votes |
protected void applyTabLayoutTheme(TabLayout tabLayout) { int toolbarAndTabBackgroundColor = customThemeWrapper.getColorPrimary(); tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor); tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator()); tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(), customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor()); }
Example #28
Source File: SoundChooserDialog.java From Alarmio with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.dialog_sound_chooser, container, false); Aesthetic.Companion.get() .colorPrimary() .take(1) .subscribe(integer -> view.setBackgroundColor(integer)); TabLayout tabLayout = view.findViewById(R.id.tabLayout); ViewPager viewPager = view.findViewById(R.id.viewPager); AlarmSoundChooserFragment alarmFragment = new AlarmSoundChooserFragment(); RingtoneSoundChooserFragment ringtoneFragment = new RingtoneSoundChooserFragment(); RadioSoundChooserFragment radioFragment = new RadioSoundChooserFragment(); FileSoundChooserFragment fileFragment = new FileSoundChooserFragment(); alarmFragment.setListener(this); ringtoneFragment.setListener(this); radioFragment.setListener(this); fileFragment.setListener(this); viewPager.setAdapter(new SimplePagerAdapter( getContext(), getChildFragmentManager(), new AlarmSoundChooserFragment.Instantiator(view.getContext(), this), new RingtoneSoundChooserFragment.Instantiator(view.getContext(), this), new RadioSoundChooserFragment.Instantiator(view.getContext(), this), new FileSoundChooserFragment.Instantiator(view.getContext(), this)) ); tabLayout.setupWithViewPager(viewPager); return view; }
Example #29
Source File: TabLayoutHelper.java From android-tablayouthelper with Apache License 2.0 | 5 votes |
@Override public void onPageSelected(int position) { final TabLayout tabLayout = mTabLayoutRef.get(); if (tabLayout != null && tabLayout.getSelectedTabPosition() != position) { // Select the tab, only updating the indicator if we're not being dragged/settled // (since onPageScrolled will handle that). Internal.selectTab(tabLayout, tabLayout.getTabAt(position), mScrollState == ViewPager.SCROLL_STATE_IDLE); } }
Example #30
Source File: MainActivity.java From LollipopContactsRecyclerViewFastScroller with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); //note : part of the design library sample code was taken from : https://github.com/sitepoint-editors/Design-Demo/ DesignDemoPagerAdapter adapter = new DesignDemoPagerAdapter(getSupportFragmentManager(), FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT); ViewPager viewPager = findViewById(R.id.viewpager); viewPager.setAdapter(adapter); TabLayout tabLayout = findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); }