当前位置: 首页>>代码示例>>Java>>正文


Java RecyclerTabLayout类代码示例

本文整理汇总了Java中com.nshmura.recyclertablayout.RecyclerTabLayout的典型用法代码示例。如果您正苦于以下问题:Java RecyclerTabLayout类的具体用法?Java RecyclerTabLayout怎么用?Java RecyclerTabLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RecyclerTabLayout类属于com.nshmura.recyclertablayout包,在下文中一共展示了RecyclerTabLayout类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import com.nshmura.recyclertablayout.RecyclerTabLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.schedule_fragment, null);
    Log.d(TAG, "onCreateView");

    DaysPagerAdapter daysPagerAdapter = new DaysPagerAdapter();
    daysPager = (ViewPager) v.findViewById(R.id.days_pager);
    daysPager.setAdapter(daysPagerAdapter);

    RecyclerTabLayout daysView = (RecyclerTabLayout) v.findViewById(R.id.recycler_tab_layout);
    daysView.setUpWithViewPager(daysPager);
    daysView.setHasFixedSize(true);

    return v;
}
 
开发者ID:H8Code,项目名称:FUNS-android,代码行数:17,代码来源:ScheduleFragment.java

示例2: onCreate

import com.nshmura.recyclertablayout.RecyclerTabLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    JodaTimeAndroid.init(this);

    Funs.getInstance().setContext(getApplicationContext());
    
    setContentView(R.layout.activity_main);

    FunsPageAdapter adapter = new FunsPageAdapter();

    ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(Funs.getInstance().getViewPagerCurrentItem());

    RecyclerTabLayout recyclerTabLayout = (RecyclerTabLayout)
            findViewById(R.id.recycler_tab_layout);
    recyclerTabLayout.setUpWithViewPager(viewPager);
}
 
开发者ID:sib-401-o-2,项目名称:FUNS_old,代码行数:20,代码来源:MainActivity.java

示例3: onCreate

import com.nshmura.recyclertablayout.RecyclerTabLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_custom_view02);

    Demo demo = Demo.valueOf(getIntent().getStringExtra(KEY_DEMO));

    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    DemoImagePagerAdapter adapter = new DemoImagePagerAdapter();
    adapter.addAll(DemoData.loadImageResourceList());

    ViewPager viewPager = findViewById(R.id.view_pager);
    viewPager.setAdapter(adapter);

    RecyclerTabLayout recyclerTabLayout = findViewById(R.id.recycler_tab_layout);
    recyclerTabLayout.setUpWithAdapter(new DemoCustomView02Adapter(viewPager));
    recyclerTabLayout.setPositionThreshold(0.5f);
}
 
开发者ID:nshmura,项目名称:RecyclerTabLayout,代码行数:23,代码来源:DemoCustomView02Activity.java

示例4: onCreate

import com.nshmura.recyclertablayout.RecyclerTabLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_basic);

    Demo demo = Demo.valueOf(getIntent().getStringExtra(KEY_DEMO));

    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    int startYear = 1900;
    int endYear = 3000;
    int initialYear = Calendar.getInstance().get(Calendar.YEAR);

    List<String> items = new ArrayList<>();
    for (int i = startYear; i <= endYear; i++) {
        items.add(String.valueOf(i));
    }

    DemoYearsPagerAdapter adapter = new DemoYearsPagerAdapter();
    adapter.addAll(items);

    ViewPager viewPager = findViewById(R.id.view_pager);
    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(initialYear - startYear);

    RecyclerTabLayout recyclerTabLayout = findViewById(R.id.recycler_tab_layout);
    recyclerTabLayout.setUpWithViewPager(viewPager);
}
 
开发者ID:nshmura,项目名称:RecyclerTabLayout,代码行数:32,代码来源:DemoYearsActivity.java

示例5: onCreate

import com.nshmura.recyclertablayout.RecyclerTabLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_basic);

    Demo demo = Demo.valueOf(getIntent().getStringExtra(KEY_DEMO));

    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mItems = new ArrayList<>();
    mItems.add(":)");
    for (int i = 1; i <= 9; i++) {
        mItems.add(String.valueOf(i));
    }

    mAdapter = new DemoImitationLoopPagerAdapter();
    mAdapter.addAll(mItems);

    mViewPager = findViewById(R.id.view_pager);
    mViewPager.setAdapter(mAdapter);
    mViewPager.setCurrentItem(mAdapter.getCenterPosition(0));
    mViewPager.addOnPageChangeListener(this);

    RecyclerTabLayout recyclerTabLayout = findViewById(R.id.recycler_tab_layout);
    recyclerTabLayout.setUpWithViewPager(mViewPager);
}
 
开发者ID:nshmura,项目名称:RecyclerTabLayout,代码行数:30,代码来源:DemoImitationLoopActivity.java

示例6: onCreate

import com.nshmura.recyclertablayout.RecyclerTabLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_custom_view01);

    Demo demo = Demo.valueOf(getIntent().getStringExtra(KEY_DEMO));

    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    List<ColorItem> items = DemoData.loadDemoColorItems(this);
    Collections.sort(items, new Comparator<ColorItem>() {
        @Override
        public int compare(ColorItem lhs, ColorItem rhs) {
            return lhs.name.compareTo(rhs.name);
        }
    });

    DemoColorPagerAdapter adapter = new DemoColorPagerAdapter();
    adapter.addAll(items);

    ViewPager viewPager = findViewById(R.id.view_pager);
    viewPager.setAdapter(adapter);

    RecyclerTabLayout recyclerTabLayout = findViewById(R.id.recycler_tab_layout);
    recyclerTabLayout.setUpWithAdapter(new DemoCustomView01Adapter(viewPager));
}
 
开发者ID:nshmura,项目名称:RecyclerTabLayout,代码行数:30,代码来源:DemoCustomView01Activity.java


注:本文中的com.nshmura.recyclertablayout.RecyclerTabLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。