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


Java SmartTabLayout类代码示例

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


SmartTabLayout类属于com.ogaclejapan.smarttablayout包,在下文中一共展示了SmartTabLayout类的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: initView

import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入依赖的package包/类
@Override
    protected void initView() {
//        CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) mView.findViewById(
//                R.id.collapse_toolbar);
//        collapsingToolbar.setTitleEnabled(false);
//        appBarLayout = (AppBarLayout) mView.findViewById(R.id.appBarLayout);
//        appBarLayout.addOnOffsetChangedListener(this);
//
//        toolbar = (Toolbar) mView.findViewById(R.id.toolbar);
//
//        //set the toolbar
//        int toolbar_hight = 100;
//        CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();
//        params.height = toolbar_hight;
//        toolbar.setLayoutParams(params);

        mViewpagertab = (SmartTabLayout) mView.findViewById(R.id.viewpagertab);
        mVpJoke = (ViewPager) mView.findViewById(R.id.vp_joke);
    }
 
开发者ID:GaoGersy,项目名称:LiveShow,代码行数:20,代码来源:JokeFragment.java

示例8: setupTabView

import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入依赖的package包/类
protected void setupTabView() {
    final LayoutInflater inflater = LayoutInflater.from(this);
    final int[] tabIcons = {R.drawable.ic_recommended, R.drawable.ic_topics, R.drawable.ic_wiki, R.drawable.ic_me};
    FragmentPagerItems pages = FragmentPagerItems.with(this)
            .add(R.string.recommended, RecommendedFragment.class)
            .add(R.string.topics, TopicsFragment.class)
            .add(R.string.wiki, WikiFragment.class)
            .add(R.string.me, MeFragment.class)
            .create();
    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
            getSupportFragmentManager(),
            pages);

    viewPager.setOffscreenPageLimit(pages.size());
    viewPager.setAdapter(adapter);
    viewpagerTab.setCustomTabView(new SmartTabLayout.TabProvider() {
        @Override
        public View createTabView(ViewGroup container, int position, PagerAdapter pagerAdapter) {
            View view = inflater.inflate(R.layout.custom_tab_icon, container, false);
            ImageView iconView = (ImageView) view.findViewById(R.id.iv_icon);
            iconView.setBackgroundResource(tabIcons[position % tabIcons.length]);
            return view;
        }
    });
    viewpagerTab.setViewPager(viewPager);
}
 
开发者ID:CycloneAxe,项目名称:phphub-android,代码行数:27,代码来源:MainActivity.java

示例9: bindView

import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入依赖的package包/类
private void bindView() {
    mCoordinatorLayout = findViewById(R.id.container);
    String text = getTextFromAnotherApp();

    ViewPager viewPager = findViewById(R.id.view_pager);
    FragmentPagerAdapter adapter = getPageAdapter(text);
    viewPager.setOffscreenPageLimit(adapter.getCount());
    viewPager.setAdapter(adapter);
    viewPager.addOnPageChangeListener(this);
    ((SmartTabLayout) findViewById(R.id.tab_layout)).setViewPager(viewPager);

    //attach listener hide/show keyboard
    KeyBoardEventListener keyBoardEventListener = new KeyBoardEventListener(this);
    mCoordinatorLayout.getViewTreeObserver().addOnGlobalLayoutListener(keyBoardEventListener);
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:16,代码来源:MainActivity.java

示例10: 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

示例11: 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

示例12: onCreate

import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    initToolbar();
    SPUtils.init(getApplicationContext());
    viewPager = (ViewPager) findViewById(R.id.viewPager);
    viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
    fragmentPagerItems = new FragmentPagerItems(this);
    location = new Location(MainActivity.this,handler);
    location.location();
    getCityList();
    addList();

}
 
开发者ID:cmz-one,项目名称:EasyWeather,代码行数:16,代码来源:MainActivity.java

示例13: 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

示例14: 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

示例15: initViewPager

import com.ogaclejapan.smarttablayout.SmartTabLayout; //导入依赖的package包/类
private void initViewPager(ViewPager viewPager, SmartTabLayout smartTabLayout) {
        StatsAndTopUsersPagerAdapter bookPanelPagerAdapter = new StatsAndTopUsersPagerAdapter(getSupportFragmentManager());
        viewPager.setAdapter(bookPanelPagerAdapter);

        //TODO: UNCOMMENT WHEN RANKING  WILL BE READY
//        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_assessment_white_36dp));
//                        text.setText(getString(R.string.tab_title_statistic));
//                        break;
//                    case 1:
//                        icon.setImageDrawable(resources.getDrawable(R.drawable.ic_star_white_36dp));
//                        text.setText(getString(R.string.tab_title_ranking));
//                        break;
//                    default:
//                        throw new IllegalStateException("Invalid position: " + position);
//                }
//                return itemView;
//            }
//        });
//        smartTabLayout.setViewPager(viewPager);
    }
 
开发者ID:hypeapps,项目名称:wykopolka-android,代码行数:32,代码来源:StatsAndTopUsersActivity.java


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