Java Code Examples for android.support.design.widget.TabLayout#Tab
The following examples show how to use
android.support.design.widget.TabLayout#Tab .
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: TimetableActivity.java From Sunshine with Apache License 2.0 | 6 votes |
private void initTabLayout() { int dayOfWeek = DateUtil.getDayOfWeek() - 1; int datesOfWeek[] = DateUtil.getDatesOfWeek(); for (int i = 0; i < 7; i++) { ItemTabBinding itemTabBinding = ItemTabBinding.inflate(LayoutInflater.from(this), binding.tabLayout, false); itemTabBinding.setItemWeek(DateUtil.week[i]); itemTabBinding.setItemDate(String.valueOf(datesOfWeek[i])); //暂不清楚为什么布局宽度会出现问题,这里需要重新设置下布局参数(100只是随便写的一个值,后需修改) itemTabBinding.getRoot().setLayoutParams(new LinearLayout.LayoutParams( 100, LinearLayout.LayoutParams.WRAP_CONTENT )); TabLayout.Tab tab = binding.tabLayout.newTab().setCustomView(itemTabBinding.getRoot()); binding.tabLayout.addTab(tab); if (dayOfWeek == i) { tab.select(); } } binding.tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); binding.tabLayout.addOnTabSelectedListener(this); }
Example 2
Source File: AddressCheckActivity.java From AddressChecker with Apache License 2.0 | 6 votes |
@Override public void onTabSelected(TabLayout.Tab tab) { int newPosition = tab.getPosition(); switch (newPosition) { case 1: { if (mTwoList == null) { mTabLayout.getTabAt(mCurrentPosition).select(); return; } break; } case 2: { if (mThreeList == null) { mTabLayout.getTabAt(mCurrentPosition).select(); return; } break; } } this.mCurrentPosition = tab.getPosition(); }
Example 3
Source File: TGMainDrawer.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public void createTab(TabLayout tabLayout, int layoutId, String indicator, Object selectedTab) { TabLayout.Tab tab = tabLayout.newTab(); tab.setTag(layoutId); tab.setText(indicator); tabLayout.addTab(tab); if( selectedTab != null && selectedTab.equals(layoutId)) { tab.select(); } }
Example 4
Source File: EntryTabDelegate.java From CapturePacket with MIT License | 5 votes |
private void initTab() { if (mTabLayout.getTabCount() == 0) { TabLayout tabLayout = mTabLayout; String[] tabTitles = {TAB_OVERVIEW, TAB_HEADERS, TAB_COOKIES,TAB_QUERY,TAB_PARAMS,TAB_CONTENT}; for (String title : tabTitles) { TabLayout.Tab tab = tabLayout.newTab(); tab.setText(title); tabLayout.addTab(tab,false); } tabLayout.addOnTabSelectedListener(this); } }
Example 5
Source File: ClearBrowsingDataTabsFragment.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) {}
Example 6
Source File: ToolListActivity.java From auid2 with Apache License 2.0 | 4 votes |
@Override public void onTabSelected(TabLayout.Tab tab) { mViewPager.setCurrentItem(tab.getPosition()); }
Example 7
Source File: MainActivity.java From android-auto-call-recorder with MIT License | 4 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) { mEventBus.post(new OnTabUnSelected(tab.getPosition())); }
Example 8
Source File: MainActivity.java From photosearcher with Apache License 2.0 | 4 votes |
@Override public void onTabReselected(TabLayout.Tab tab) { int position = tab.getPosition(); String query = mTimelineManager.getItem(position); mBus.post(new SearchTimelineScrollEvent(query, 0)); }
Example 9
Source File: MainActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 4 votes |
@Override public void onTabSelected(TabLayout.Tab tab) { int position = tab.getPosition(); tab.setIcon(tabSelectedIcon[position]); mTabTitle.setText(tabTitles[position]); }
Example 10
Source File: QQBrowserDemoActivity.java From CoordinatorLayoutExample with Apache License 2.0 | 4 votes |
@Override public void onTabSelected(TabLayout.Tab tab) { mNewsPager.setCurrentItem(tab.getPosition()); }
Example 11
Source File: GoodsListActivity.java From enjoyshop with Apache License 2.0 | 4 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) { }
Example 12
Source File: MainActivity.java From MediaPickerInstagram with Apache License 2.0 | 4 votes |
private void displayTitleByTab(TabLayout.Tab tab) { if (tab.getText() != null) { String title = tab.getText().toString(); mToolbar.setTitle(title); } }
Example 13
Source File: PaginationHelper.java From ForPDA with GNU General Public License v3.0 | 2 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) { }
Example 14
Source File: MainActivity.java From android with MIT License | 2 votes |
/** * Implements TabLayout.OnTabSelectedListener * * @param tab */ @Override public void onTabUnselected(TabLayout.Tab tab) { hideMarkerInfo(); }
Example 15
Source File: OnTabSelectedListenerAdapter.java From tysq-android with GNU General Public License v3.0 | 2 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) { }
Example 16
Source File: QQBrowserDemoActivity.java From CoordinatorLayoutExample with Apache License 2.0 | 2 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) { }
Example 17
Source File: OnTabSelectedListenerAdapter.java From outlay with Apache License 2.0 | 2 votes |
@Override public void onTabUnselected(TabLayout.Tab tab) { }
Example 18
Source File: ToolListActivity.java From auid2 with Apache License 2.0 | 2 votes |
@Override public void onTabReselected(TabLayout.Tab tab) { }
Example 19
Source File: OnTabSelectedListenerAdapter.java From outlay with Apache License 2.0 | 2 votes |
@Override public void onTabSelected(TabLayout.Tab tab) { }
Example 20
Source File: PaginationHelper.java From ForPDA with GNU General Public License v3.0 | votes |
boolean onTabSelected(TabLayout.Tab tab);