Search in sources :

Example 56 with TabLayout

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);
}
Also used : TabLayout(android.support.design.widget.TabLayout) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Example 57 with TabLayout

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);
}
Also used : TabLayout(android.support.design.widget.TabLayout) ViewPager(android.support.v4.view.ViewPager) Toolbar(android.support.v7.widget.Toolbar)

Example 58 with TabLayout

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);
}
Also used : TabLayout(android.support.design.widget.TabLayout)

Example 59 with TabLayout

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);
            }
        }
    }
}
Also used : TabLayout(android.support.design.widget.TabLayout) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 60 with TabLayout

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();
}
Also used : TabLayout(android.support.design.widget.TabLayout) RecordingObserver(com.jakewharton.rxbinding2.RecordingObserver) Test(org.junit.Test) UiThreadTest(android.support.test.annotation.UiThreadTest) UiThreadTest(android.support.test.annotation.UiThreadTest)

Aggregations

TabLayout (android.support.design.widget.TabLayout)75 View (android.view.View)33 ViewPager (android.support.v4.view.ViewPager)28 Toolbar (android.support.v7.widget.Toolbar)17 TextView (android.widget.TextView)13 Intent (android.content.Intent)12 ActionBar (android.support.v7.app.ActionBar)10 RecyclerView (android.support.v7.widget.RecyclerView)10 Fragment (android.support.v4.app.Fragment)8 ImageView (android.widget.ImageView)8 Test (org.junit.Test)8 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 UiController (android.support.test.espresso.UiController)7 ViewAction (android.support.test.espresso.ViewAction)7 AppBarLayout (android.support.design.widget.AppBarLayout)6 NavigationView (android.support.design.widget.NavigationView)6 ViewGroup (android.view.ViewGroup)6 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)5 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)5 PagerAdapter (android.support.v4.view.PagerAdapter)4