本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}