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


Java SlidingTabLayout.setViewPager方法代码示例

本文整理汇总了Java中com.example.android.common.view.SlidingTabLayout.setViewPager方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingTabLayout.setViewPager方法的具体用法?Java SlidingTabLayout.setViewPager怎么用?Java SlidingTabLayout.setViewPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.example.android.common.view.SlidingTabLayout的用法示例。


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

示例1: onCreateView

import com.example.android.common.view.SlidingTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.fragment_live, container, false);

	ViewPager pager = (ViewPager) view.findViewById(R.id.pager);
	pager.setAdapter(livePagerAdapter);
	SlidingTabLayout slidingTabs = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
	slidingTabs.setViewPager(pager);

	return view;
}
 
开发者ID:sysdharma,项目名称:py-eventos-android,代码行数:12,代码来源:LiveFragment.java

示例2: setupView

import com.example.android.common.view.SlidingTabLayout; //导入方法依赖的package包/类
private void setupView(View view) {
    final ViewPager pager = (ViewPager) view.findViewById(R.id.main_pager);
    pager.setAdapter(createPagerAdapter());

    final SlidingTabLayout tab = (SlidingTabLayout) view.findViewById(R.id.main_tab);
    tab.setCustomTabView(R.layout.layout_main_tab, R.id.main_tab_text);
    tab.setViewPager(pager);
}
 
开发者ID:t28hub,项目名称:section-adapter,代码行数:9,代码来源:MainFragment.java

示例3: onCreate

import com.example.android.common.view.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	// Drawer
	mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
	mDrawer = (LinearLayout)findViewById(R.id.drawer);
	mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

	getSupportActionBar().setHomeButtonEnabled(true);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);

	mDrawerToggle = new ActionBarDrawerToggle(
			this,
			mDrawerLayout,
			R.drawable.ic_drawer,
			R.string.drawer_open,
			R.string.drawer_close) {
		
		public void onDrawerClosed(View view) {
               super.onDrawerClosed(view);
		}

		public void onDrawerOpened(View drawerView) {
			super.onDrawerOpened(drawerView);
		}
	};
	
	mDrawerLayout.setDrawerListener(mDrawerToggle);
	actionBar = getSupportActionBar();

       // ViewPager
       mViewPager = (ViewPager) findViewById(R.id.viewpager);
       mViewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), tabsTitles));

       mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
       mSlidingTabLayout.setViewPager(mViewPager);
   }
 
开发者ID:jiahaoliuliu,项目名称:DrawerWithTabsAndViewPagerGradle,代码行数:40,代码来源:MainActivity.java

示例4: initLayout

import com.example.android.common.view.SlidingTabLayout; //导入方法依赖的package包/类
private void initLayout() {

//		getActionBar().setDisplayHomeAsUpEnabled(true);
//		getActionBar().setDisplayShowHomeEnabled(true);
//		getActionBar().setTitle(getString(R.string.filter));


//		ActionBar actionBar = getActionBar();
//
//		actionBar.setDisplayHomeAsUpEnabled(true);
//		actionBar.setDisplayShowHomeEnabled(true);
//		actionBar.setTitle(getString(R.string.filter));
//		actionBar.setIcon(R.drawable.ic_filter);

		View title = getLayoutInflater().inflate(R.layout.filteractivity_title_layout, null);
		Switch switchBtn = (Switch) title.findViewById(R.id.switchBtn);
//		actionBar.setCustomView(title, new ActionBar.LayoutParams(Gravity.RIGHT));
//		actionBar.setDisplayShowCustomEnabled(true);

		switchBtn.setChecked(SettingUtils.isEnableFilter());
		switchBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				SettingUtils.setEnableFilter(isChecked);
			}
		});

//		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
//		actionBar.addTab(actionBar.newTab().setText(getString(R.string.filter_keyword)).setTabListener(tabListener));
//
//		actionBar.addTab(actionBar.newTab().setText(getString(R.string.filter_user)).setTabListener(tabListener));
//		actionBar.addTab(actionBar.newTab().setText(getString(R.string.filter_topic)).setTabListener(tabListener));
//
//		actionBar.addTab(actionBar.newTab().setText(getString(R.string.filter_source)).setTabListener(tabListener));

		mSlidingTab = (SlidingTabLayout) findViewById(R.id.filterSTL);
		viewPager = (ViewPager) findViewById(R.id.filterViewpager);
		TimeLinePagerAdapter adapter = new TimeLinePagerAdapter(getSupportFragmentManager());
		viewPager.setOffscreenPageLimit(4);
		viewPager.setAdapter(adapter);
		viewPager.setOnPageChangeListener(onPageChangeListener);
		mSlidingTab.setViewPager(viewPager);

	}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:45,代码来源:FilterActivity.java


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