本文整理汇总了Java中com.ogaclejapan.smarttablayout.SmartTabLayout.setViewPager方法的典型用法代码示例。如果您正苦于以下问题:Java SmartTabLayout.setViewPager方法的具体用法?Java SmartTabLayout.setViewPager怎么用?Java SmartTabLayout.setViewPager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ogaclejapan.smarttablayout.SmartTabLayout
的用法示例。
在下文中一共展示了SmartTabLayout.setViewPager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
private void init() {
mPagerTab = (SmartTabLayout) findViewById(R.id.viewpagerTab);
initPagerTab();
mPager = (ViewPager) findViewById(R.id.mainPager);
FragmentPagerItems pages = FragmentPagerItems.with(mActivity)
.add(R.string.tab_hi, HiTalkFragment.class)
.add(R.string.tab_message, MessageFragment.class)
.add(R.string.tab_address, AddressFragment.class)
.add(R.string.tab_blackboard, BlackboardFragment.class)
.add(R.string.tab_me, MeFragment.class)
.create();
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
mActivity.getSupportFragmentManager(), pages);
mPager.setOffscreenPageLimit(5);
mPager.setAdapter(adapter);
mPagerTab.setViewPager(mPager);
}
示例2: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_item_one, container, false);
ViewPager viewPager = (ViewPager) view.findViewById(R.id.activity_profile_viewpager);
this.addPages(viewPager);
// Give the PagerSlidingTabStrip the ViewPager
SmartTabLayout tabsStrip = (SmartTabLayout) view.findViewById(R.id.tabs_main_activity);
// Attach the view pager to the tab strip
tabsStrip.setViewPager(viewPager);
return view;
}
示例3: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_feed, container, false);
ViewPager viewPager = (ViewPager) view.findViewById(R.id.activity_discover_viewpager);
this.addPages(viewPager);
// Give the PagerSlidingTabStrip the ViewPager
SmartTabLayout tabsStrip = (SmartTabLayout) view.findViewById(R.id.activity_discover_tab_layout);
// Attach the view pager to the tab strip
tabsStrip.setViewPager(viewPager);
return view;
}
示例4: initview
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
private void initview() {
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
getActivity().getSupportFragmentManager(), FragmentPagerItems.with(getActivity())
.add(R.string.a, MainFragment.class)
.add(R.string.b, SpecialFragment.class)
.add(R.string.c, FriendsFragment.class)
.create());
ViewPager viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
viewPager.setOffscreenPageLimit(2);
viewPager.setAdapter(adapter);
SmartTabLayout viewPagerTab = (SmartTabLayout) rootView.findViewById(R.id.viewpagertab);
viewPagerTab.setViewPager(viewPager);
}
示例5: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
ViewPager viewPager = (ViewPager) view.findViewById(R.id.fragment_home_pager);
SmartTabLayout smartTabLayout = (SmartTabLayout) view.findViewById(R.id.fragment_home_tab_smart);
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
getActivity().getSupportFragmentManager(), FragmentPagerItems.with(getContext())
.add("首页", WatchFragment.class)
.add("新闻", FreshNewsFragment.class)
.create());
ButterKnife.bind(this, view);
viewPager.setAdapter(adapter);
smartTabLayout.setViewPager(viewPager);
return view;
}
示例6: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_personal_home, container, false);
ViewPager viewPager = (ViewPager) view.findViewById(R.id.fragment_personal_home_pager);
SmartTabLayout smartTabLayout = (SmartTabLayout) view.findViewById(R.id.fragment_personal_home_tab_smart);
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
getActivity().getSupportFragmentManager(), FragmentPagerItems.with(getContext())
.add("个人成绩", ScoreFragment.class)
.add("图表分析", ListViewMultiChartFragment.class)
.create());
ButterKnife.bind(view);
viewPager.setAdapter(adapter);
smartTabLayout.setViewPager(viewPager);
return view;
}
示例7: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_favourites, container, false);
mSmartTabLayout = (SmartTabLayout) view.findViewById(R.id.tab_view_pager_fav);
mViewPager = (ViewPager) view.findViewById(R.id.view_pager_fav);
mViewPager.setAdapter(new FavouritesPagerAdapter(getChildFragmentManager(), getContext()));
mSmartTabLayout.setViewPager(mViewPager);
return view;
}
示例8: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_item_two, container, false);
ViewPager viewPager = (ViewPager) view.findViewById(R.id.activity_groups_viewpager);
this.addPages(viewPager);
// Give the PagerSlidingTabStrip the ViewPager
SmartTabLayout tabsStrip = (SmartTabLayout) view.findViewById(R.id.activity_groups_tab_layout);
// Attach the view pager to the tab strip
tabsStrip.setViewPager(viewPager);
return view;
}
示例9: init
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
private void init(){
mTabs = (SmartTabLayout) findViewById(R.id.tabs);
mainTabFragmentAdapter = new MainTabFragmentAdapter(getSupportFragmentManager(),this);
mViewPager = (ViewPager) findViewById(R.id.viewpager);
mViewPager.setAdapter(mainTabFragmentAdapter);
mTabs.setViewPager(mViewPager);
mViewPager.setOffscreenPageLimit(mainTabFragmentAdapter.getCount());
headerLayout = (LinearLayout) findViewById(R.id.ll_header_layout);
initAppBarLayout();
}
示例10: initViewPager
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
private void initViewPager(ViewPager viewPager, SmartTabLayout smartTabLayout) {
BookPanelPagerAdapter bookPanelPagerAdapter = new BookPanelPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(bookPanelPagerAdapter);
final LayoutInflater layoutInflater = LayoutInflater.from(this);
final Resources resources = getResources();
smartTabLayout.setCustomTabView(new SmartTabLayout.TabProvider() {
@Override
public View createTabView(ViewGroup container, int position, PagerAdapter adapter) {
View itemView = layoutInflater.inflate(R.layout.tab_icon_text, container, false);
TextView text = (TextView) itemView.findViewById(R.id.custom_tab_text);
text.setAllCaps(true);
ImageView icon = (ImageView) itemView.findViewById(R.id.custom_tab_icon);
switch (position) {
case 0:
icon.setImageDrawable(resources.getDrawable(R.drawable.ic_book_white_36dp));
text.setText(getString(R.string.tab_title_my_books));
break;
case 1:
icon.setImageDrawable(resources.getDrawable(R.drawable.ic_added_book_white_36dp));
text.setText(getString(R.string.tab_title_added_books));
break;
default:
throw new IllegalStateException("Invalid position: " + position);
}
return itemView;
}
});
smartTabLayout.setViewPager(viewPager);
}
示例11: initViewPager
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
private void initViewPager(ViewPager viewPager, SmartTabLayout smartTabLayout) {
mDashboardPagerAdapter = new DashboardPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mDashboardPagerAdapter);
final LayoutInflater layoutInflater = LayoutInflater.from(this);
final Resources resources = getResources();
smartTabLayout.setCustomTabView(new SmartTabLayout.TabProvider() {
@Override
public View createTabView(ViewGroup container, int position, PagerAdapter adapter) {
View itemView = layoutInflater.inflate(R.layout.tab_dashboard_icon_text, container, false);
TextView text = (TextView) itemView.findViewById(R.id.custom_tab_text);
text.setAllCaps(true);
ImageView icon = (ImageView) itemView.findViewById(R.id.custom_tab_icon);
switch (position) {
case 0:
icon.setImageDrawable(resources.getDrawable(R.drawable.ic_thumb_up_white_36dp));
text.setText(getString(R.string.tab_title_recommended));
break;
case 1:
icon.setImageDrawable(resources.getDrawable(R.drawable.ic_hourglass_full_white_36dp));
text.setText(getString(R.string.tab_title_waiting));
break;
case 2:
icon.setImageDrawable(resources.getDrawable(R.drawable.ic_favorite_white_36dp));
text.setText(getString(R.string.tab_title_wishlist));
break;
default:
throw new IllegalStateException("Invalid position: " + position);
}
return itemView;
}
});
smartTabLayout.setViewPager(viewPager);
}
示例12: onCreate
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_direction);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("方向控制");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// ViewGroup tab = (ViewGroup) findViewById(R.id.tab);
// tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false));
final ViewPager viewPager = (NoScrollViewPager) findViewById(R.id.viewpager);
final SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
// demo.setup(viewPagerTab);
FragmentPagerItems pages = new FragmentPagerItems(this);
pages.add(FragmentPagerItem.of(mCharSequences[0], GravitySensorFragment.class));
pages.add(FragmentPagerItem.of(mCharSequences[1], DirectionFragment.class));
pages.add(FragmentPagerItem.of(mCharSequences[2], JoyStickFragment.class));
FragmentStatePagerItemAdapter adapter = new FragmentStatePagerItemAdapter(
getSupportFragmentManager(), pages);
viewPager.setAdapter(adapter);
viewPagerTab.setViewPager(viewPager);
}
示例13: onCreateView
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
parentView = View.inflate(getContext(), R.layout.layout_top_navigation,null);
viewPager = (ViewPager) parentView.findViewById(R.id.inner_viewpager);
smartTabLayout = (SmartTabLayout) getActivity().findViewById(R.id.tab_layout);
smartTabLayout.setVisibility(View.VISIBLE);
pagerAdapter = initPagerAdapter();
viewPager.setAdapter(pagerAdapter);
smartTabLayout.setViewPager(viewPager);
return parentView;
}
示例14: onCreate
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
vp = (ViewPager)findViewById(R.id.viewpager);
smartTab = (SmartTabLayout)findViewById(R.id.viewpagertab);
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
getSupportFragmentManager(), FragmentPagerItems.with(this)
.add(R.string.News, SectionFragment.class)
.add(R.string.ThisWeek, SectionFragment.class)
.add(R.string.Leaders, SectionFragment.class)
.add(R.string.Letters, SectionFragment.class)
.add(R.string.Briefing, SectionFragment.class)
.add(R.string.US, SectionFragment.class)
.add(R.string.Americas, SectionFragment.class)
.add(R.string.Asia, SectionFragment.class)
.add(R.string.China, SectionFragment.class)
.add(R.string.MEAA, SectionFragment.class)
.add(R.string.Europe, SectionFragment.class)
.add(R.string.Britain, SectionFragment.class)
.add(R.string.International, SectionFragment.class)
.add(R.string.Business, SectionFragment.class)
.add(R.string.Finance, SectionFragment.class)
.add(R.string.Science, SectionFragment.class)
.add(R.string.Books, SectionFragment.class)
.add(R.string.Obituary, SectionFragment.class)
.add(R.string.Figures, SectionFragment.class)
.create());
vp.setAdapter(adapter);
smartTab.setViewPager(vp);
}
示例15: onCreate
import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Check for light theme
Prefs.load(this);
if(Prefs.useLightTheme()){
setTheme(R.style.Theme_DeployThemeLight);
}
setContentView(R.layout.activity_widget_config);
Bundle extras = getIntent().getExtras();
if(extras != null){
mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
mResultIntent = new Intent();
//Set it to cancelled until explicitly told to save
setResult(RESULT_CANCELED, mResultIntent);
mWidgetManager = AppWidgetManager.getInstance(this);
mAdapter = new DeploymentFragmentAdapter(this, getSupportFragmentManager());
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(mAdapter);
SmartTabLayout indicator = (SmartTabLayout) findViewById(R.id.indicator);
indicator.setViewPager(pager);
indicator.setOnPageChangeListener(new PageChangeListener());
pager.setCurrentItem(mCurrentPosition);
Log.d("WidgetPicker started with mWidgetId "+ mWidgetId);
}