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


Java SmartTabLayout.setViewPager方法代码示例

本文整理汇总了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);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:20,代码来源:HiTalkLayout.java

示例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;
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:17,代码来源:ProfilePageFragment.java

示例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;

}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:19,代码来源:FeedFragment.java

示例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);

}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:18,代码来源:ViewPagerFragmwnt.java

示例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;
}
 
开发者ID:niuzehai,项目名称:Sxumiro_AndroidClient,代码行数:18,代码来源:HomeFragment.java

示例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;
}
 
开发者ID:niuzehai,项目名称:Sxumiro_AndroidClient,代码行数:17,代码来源:MyHomeFragment.java

示例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;
}
 
开发者ID:hitanshu-dhawan,项目名称:PopCorn,代码行数:13,代码来源:FavouritesFragment.java

示例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;
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:16,代码来源:GroupsFragment.java

示例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();
}
 
开发者ID:felix1022224,项目名称:adjustablelayout,代码行数:12,代码来源:MainActivity.java

示例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);
}
 
开发者ID:hypeapps,项目名称:wykopolka-android,代码行数:31,代码来源:BookPanelActivity.java

示例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);
}
 
开发者ID:hypeapps,项目名称:wykopolka-android,代码行数:35,代码来源:DashboardActivity.java

示例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);

    }
 
开发者ID:BrotherJing,项目名称:smartcar,代码行数:29,代码来源:DirectionActivity.java

示例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;
}
 
开发者ID:MummyDing,项目名称:Leisure,代码行数:13,代码来源:AbsTopNavigationFragment.java

示例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);
}
 
开发者ID:TheHandApp,项目名称:TheHand,代码行数:36,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Tortel,项目名称:DeployTrack,代码行数:36,代码来源:WidgetPickerActivity.java


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