use of android.support.design.widget.TabLayout in project remusic by aa112901.
the class DownActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_down);
// ButterKnife.bind(this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(DownActivity.this), 0, 0);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle("下载管理");
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
viewPager = (ViewPager) findViewById(R.id.viewPager);
if (viewPager != null) {
setupViewPager(viewPager);
viewPager.setOffscreenPageLimit(2);
}
final TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setTabTextColors(R.color.text_color, ThemeUtils.getThemeColorStateList(this, R.color.theme_color_primary).getDefaultColor());
tabLayout.setSelectedTabIndicatorColor(ThemeUtils.getThemeColorStateList(this, R.color.theme_color_primary).getDefaultColor());
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.design.widget.TabLayout in project Phoenix by Yalantis.
the class PullToRefreshActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pull_to_refresh);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
if (toolbar != null) {
setSupportActionBar(toolbar);
}
viewPager.setAdapter(new SectionPagerAdapter(getSupportFragmentManager()));
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.design.widget.TabLayout in project RecyclerViewPager by lsjwzh.
the class MaterialDemoWithLoopPagerActivity method initTabLayout.
private void initTabLayout() {
//给TabLayout增加Tab, 并关联ViewPager
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
TabLayoutSupport.setupWithViewPager(tabLayout, mRecyclerView, mAdapter);
}
use of android.support.design.widget.TabLayout in project RecyclerViewUndoSwipe by HoneyNeutrons.
the class MainActivity method setTabs.
private void setTabs() {
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
assert tabLayout != null;
tabLayout.addTab(tabLayout.newTab().setText("TAB1"));
tabLayout.addTab(tabLayout.newTab().setText("TAB2"));
tabLayout.addTab(tabLayout.newTab().setText("TAB3"));
//TabLayout font & size
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
int tabsCount = vg.getChildCount();
for (int j = 0; j < tabsCount; j++) {
ViewGroup vgTab = (ViewGroup) vg.getChildAt(j);
int tabChildsCount = vgTab.getChildCount();
for (int i = 0; i < tabChildsCount; i++) {
View tabViewChild = vgTab.getChildAt(i);
if (tabViewChild instanceof TextView) {
((TextView) tabViewChild).setTypeface(Typefaces.getRobotoBlack(this));
((TextView) tabViewChild).setTextSize(3);
}
}
}
}
use of android.support.design.widget.TabLayout in project RxBinding by JakeWharton.
the class RxTabLayoutTest method selectionEventsNoInitial.
@Test
@UiThreadTest
public void selectionEventsNoInitial() {
TabLayout empty = new TabLayout(context);
RecordingObserver<TabLayoutSelectionEvent> o = new RecordingObserver<>();
RxTabLayout.selectionEvents(empty).subscribe(o);
o.assertNoMoreEvents();
}
Aggregations