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