本文整理汇总了Java中com.astuetz.PagerSlidingTabStrip.setOnPageChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java PagerSlidingTabStrip.setOnPageChangeListener方法的具体用法?Java PagerSlidingTabStrip.setOnPageChangeListener怎么用?Java PagerSlidingTabStrip.setOnPageChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.astuetz.PagerSlidingTabStrip
的用法示例。
在下文中一共展示了PagerSlidingTabStrip.setOnPageChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
mToolbar.setTitle(R.string.app_name);
setSupportActionBar(mToolbar);
mCurrentPageId = PAGE_ID_COLOR_ITEM_LIST;
mColorItemListPage = new ColorItemListPage(this);
mColorItemListPage.setListener(this);
mPaletteListPage = new PaletteListPage(this);
mPaletteListPage.setListener(this);
mFab = (FloatingActionButton) findViewById(R.id.activity_main_fab);
mFab.setOnClickListener(this);
final MyPagerAdapter adapter = new MyPagerAdapter();
mTabs = (PagerSlidingTabStrip) findViewById(R.id.activity_main_tabs);
mViewPager = (ViewPager) findViewById(R.id.activity_main_view_pager);
mViewPager.setAdapter(adapter);
mTabs.setViewPager(mViewPager);
mTabs.setOnPageChangeListener(this);
mMainActivityFlavor = new MainActivityFlavor(this);
}
示例2: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBeyondApplication = (BeyondApplication) getApplication();
mTabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mTabs.setShouldExpand(true);
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new PagerAdapter(getFragmentManager());
mPager.setAdapter(mPagerAdapter);
mPager.setOffscreenPageLimit(2);
mTabs.setViewPager(mPager);
mTabs.setOnPageChangeListener(this);
// Bind UPnP service
Intent upnpServiceIntent = new Intent(MainActivity.this, BeyondUpnpService.class);
bindService(upnpServiceIntent, mUpnpServiceConnection, Context.BIND_AUTO_CREATE);
// Bind System service
Intent systemServiceIntent = new Intent(MainActivity.this, SystemService.class);
bindService(systemServiceIntent, mSystemServiceConnection, Context.BIND_AUTO_CREATE);
}
示例3: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example);
// Pager
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new MutableTitlePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
mPager.setOnPageChangeListener(mPagerListener);
// First page
ExamplePageFragment.resetSerialNumber();
mPagerAdapter.addPageFragment(ExamplePageFragment.newInstance(null));
// Sliding tabs example
mTabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mTabs.setViewPager(mPager);
mTabs.setOnPageChangeListener(mPagerListener);
mPagerAdapter.setTabStrip(mTabs);
resetTabIndicatorColor();
}
示例4: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewpager = (ViewPager) findViewById(R.id.viewpager);
tabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
toolBar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolBar);
tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
adapter = new TabAdapter(getSupportFragmentManager());
viewpager.setAdapter(adapter);
tabStrip.setViewPager(viewpager);
tabStrip.setOnPageChangeListener(onPageChangeListener);
changeColor(getResources().getColor(R.color.color_card_info));
}
示例5: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_main);
mScrollView = (ScrollViewSuperExtend) this.findViewById(R.id.scroll);
mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(4);
mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mPagerAdapter);
mPagerSlidingTabStrip.setViewPager(mViewPager);
mPagerSlidingTabStrip.setOnPageChangeListener(changeListener);
mViewPager.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mViewPager.getViewTreeObserver().removeGlobalOnLayoutListener(this);
mViewPager.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScrollView
.getMeasuredHeight() - mPagerSlidingTabStrip.getMeasuredHeight() - getActionBarHeight()));
}
});
}
示例6: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMinHeaderHeight = getResources().getDimensionPixelSize(R.dimen.min_header_height);
mHeaderHeight = getResources().getDimensionPixelSize(R.dimen.header_height);
mMinHeaderTranslation = -mMinHeaderHeight;
setContentView(R.layout.activity_main);
mHeader = findViewById(R.id.header);
info = (TextView) findViewById(R.id.info);
mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(4);
mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
mPagerAdapter.setTabHolderScrollingContent(this);
mViewPager.setAdapter(mPagerAdapter);
mPagerSlidingTabStrip.setViewPager(mViewPager);
mPagerSlidingTabStrip.setOnPageChangeListener(this);
mLastY=0;
}
示例7: onCreateView
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_home_card_list, container, false);
mViewPager = (ViewPager)rootView.findViewById(R.id.card_list_pager);
mPagerAdapter = new BrowsePagerAdapter(getActivity().getSupportFragmentManager());
mViewPager.setAdapter(mPagerAdapter);
mTabs =
(PagerSlidingTabStrip)rootView.findViewById(R.id.card_list_pager_title_strip);
mTabs.setViewPager(mViewPager);
mTabs.setOnPageChangeListener(pageChangeListener);
mTabs.setTextColor(Color.WHITE);
mTabs.setIndicatorColor(Color.WHITE);
return rootView;
}
示例8: initViewPager
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
private void initViewPager() {
List<Fragment> fragments = getFragments();
showPage = 0;
vp_apps = (ViewPager) findViewById(R.id.vp_apps);
vp_apps.setAdapter(new PagerAdapter(getSupportFragmentManager(), fragments));
psts_apps_tabs = (PagerSlidingTabStrip) findViewById(R.id.psts_apps_tabs);
psts_apps_tabs.setShouldExpand(true);
psts_apps_tabs.setViewPager(vp_apps);
vp_apps.setCurrentItem(showPage);
psts_apps_tabs.setBackgroundColor(getResources().getColor(R.color.main500));
psts_apps_tabs.setUnderlineColor(getResources().getColor(R.color.transparent));
psts_apps_tabs.setIndicatorColor(getResources().getColor(R.color.titlewhite));
psts_apps_tabs.setDividerColor(getResources().getColor(R.color.main500));
ViewPager.OnPageChangeListener pageListener = new PageListener();
psts_apps_tabs.setOnPageChangeListener(pageListener);
float dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
psts_apps_tabs.setIndicatorHeight((int) dp);
LinearLayout ll = (LinearLayout) psts_apps_tabs.getChildAt(0);
for(int p=0; p < ll.getChildCount(); p++) {
TextView tv = (TextView) ll.getChildAt(p);
if (p == showPage) {
tv.setTextColor(getResources().getColor(R.color.titlewhite));
} else {
tv.setTextColor(getResources().getColor(R.color.titlewhite_alpha));
}
}
}
示例9: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMinHeaderHeight = getResources().getDimensionPixelSize(R.dimen.min_header_height);
mHeaderHeight = getResources().getDimensionPixelSize(R.dimen.header_height);
mMinHeaderTranslation = -mMinHeaderHeight + getActionBarHeight();
setContentView(R.layout.activity_main);
mHeaderPicture = (KenBurnsSupportView) findViewById(R.id.header_picture);
mHeaderPicture.setResourceIds(R.drawable.pic0, R.drawable.pic1);
mHeaderLogo = (ImageView) findViewById(R.id.header_logo);
mHeader = findViewById(R.id.header);
mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(4);
mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
mPagerAdapter.setTabHolderScrollingContent(this);
mViewPager.setAdapter(mPagerAdapter);
mPagerSlidingTabStrip.setViewPager(mViewPager);
mPagerSlidingTabStrip.setOnPageChangeListener(this);
mSpannableString = new SpannableString(getString(R.string.actionbar_title));
mAlphaForegroundColorSpan = new AlphaForegroundColorSpan(0xffffffff);
ViewHelper.setAlpha(getActionBarIconView(), 0f);
getSupportActionBar().setBackgroundDrawable(null);
}
示例10: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMinHeaderHeight = getResources().getDimensionPixelSize(R.dimen.min_header_height);
mHeaderHeight = getResources().getDimensionPixelSize(R.dimen.header_height);
mMinHeaderTranslation = -mMinHeaderHeight + Utils.getActionBarHeight(this);
setContentView(R.layout.activity_main);
mHeaderPicture = (ImageView) findViewById(R.id.header_picture);
mHeaderPicture.setImageResource(R.drawable.pic3);
mHeader = findViewById(R.id.header);
mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(2);
mViewPager.requestDisallowInterceptTouchEvent(true);
mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
mPagerAdapter.setTabHolderScrollingContent(this);
mViewPager.setAdapter(mPagerAdapter);
mPagerSlidingTabStrip.setShouldExpand(true);
mPagerSlidingTabStrip.setTextColorResource(android.R.color.white);
mPagerSlidingTabStrip.setDividerColorResource(android.R.color.white);
mPagerSlidingTabStrip.setViewPager(mViewPager);
mPagerSlidingTabStrip.setOnPageChangeListener(new ActivityOnPageChangeListener());
mPagerSlidingTabStrip.setTabPaddingLeftRight(getResources().getDimensionPixelOffset(R.dimen.tab_padding));
}
示例11: onCreateView
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_game, container, false);
viewPager = (ViewPager) rootView.findViewById(R.id.fragment_game_pager);
viewPager.setAdapter(new GamePagerAdapter(getActivity().getSupportFragmentManager()));
final PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) rootView.findViewById(R.id.fragment_game_tab_strip);
tabStrip.setViewPager(viewPager);
tabStrip.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
UiUtils.callOnscreenStateChange(getPageFragment(currentPageIndex), false);
UiUtils.callOnscreenStateChange(getPageFragment(position), true);
currentPageIndex = position;
updateMenu();
}
});
final GamePage gamePage = PreferencesManager.getDesiredGamePage();
if(gamePage != null) {
setCurrentPage(gamePage);
PreferencesManager.setDesiredGamePage(null);
} else if(savedInstanceState != null) {
viewPager.setCurrentItem(savedInstanceState.getInt(KEY_PAGE_INDEX, 0));
}
findPlayerContainer = rootView.findViewById(R.id.fragment_game_find_player);
UiUtils.setupFindPlayerContainer(findPlayerContainer, this, this, (MainActivity) getActivity());
return rootView;
}
示例12: onCreateView
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_filepager, container, false);
mDirPager = (ViewPager)v.findViewById(R.id.pager);
mDirPager.setAdapter(mDirPagerAdapter);
mIndicator = (PagerSlidingTabStrip)v.findViewById(R.id.indicator);
mIndicator.setViewPager(mDirPager);
mIndicator.setOnPageChangeListener(this);
return v;
}
示例13: initViewPager
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
/**
* 初始化ViewPager
*/
private void initViewPager() {
tabs = (PagerSlidingTabStrip)_getView(R.id.tabs);
viewpager = (ViewPager) _getView(R.id.acty_alldynamic_vp_content);
View allDynamic, friendDynamic;
allDynamic = getLayoutInflater().inflate(
R.layout.item_lv_acty_alldynamic_content, null);
friendDynamic = getLayoutInflater().inflate(
R.layout.item_lv_acty_frienddynamic_content, null);
lv_AllDynamic = (XListView) allDynamic
.findViewById(R.id.item_lv_alldynamic_content);
lv_friendDynamic = (XListView) friendDynamic
.findViewById(R.id.item_lv_frienddynamic_content);
List<View> views = new ArrayList<View>();
views.add(allDynamic);
views.add(friendDynamic);
List<XListView> listviews = new ArrayList<XListView>();
listviews.add(lv_AllDynamic);
listviews.add(lv_friendDynamic);
viewpager.setAdapter(new BaseViewPagerAdapter(views,titles));
tabs.setViewPager(viewpager);
tabs.setOnPageChangeListener(new MyOnPageChangeListener(listviews));
}
示例14: initViewPager
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
private void initViewPager() {
tabs = (PagerSlidingTabStrip)_getView(R.id.tabs);
viewpager = (ViewPager) _getView(R.id.acty_comunication_content);
View all = getLayoutInflater().inflate(
R.layout.frame_acty_communication_all, null);
View myjoin = getLayoutInflater().inflate(
R.layout.frame_acty_communication_join, null);
View favourit = getLayoutInflater().inflate(
R.layout.frame_acty_communication_favourite, null);
lv_all = (XListView) all
.findViewById(R.id.frame_acty_communication_all_listview);
lv_my = (XListView) myjoin
.findViewById(R.id.frame_acty_communication_join_listview);
lv_favourit = (XListView) favourit
.findViewById(R.id.frame_acty_communication_favourite_listview);
adapter_all = new IssueAdapter(getContext(), data_all);
adapter_my = new IssueAdapter(getContext(), data_my);
adapter_favourite = new IssueAdapter(getContext(), data_favourite);
lv_all.setAdapter(adapter_all);
lv_my.setAdapter(adapter_my);
lv_favourit.setAdapter(adapter_favourite);
List<View> views = new ArrayList<View>();
views.add(all);
views.add(myjoin);
views.add(favourit);
List<XListView> listviews = new ArrayList<XListView>();
listviews.add(lv_all);
listviews.add(lv_my);
listviews.add(lv_favourit);
viewpager.setAdapter(new BaseViewPagerAdapter(views,titles));
tabs.setViewPager(viewpager);
tabs.setOnPageChangeListener(new MyOnPageChangeListener(listviews));
}
示例15: initViewPager
import com.astuetz.PagerSlidingTabStrip; //导入方法依赖的package包/类
private void initViewPager() {
tabs = (PagerSlidingTabStrip)_getView(R.id.tabs);
viewpager = (ViewPager) _getView(R.id.acty_group_content);
View all = getLayoutInflater().inflate(R.layout.frame_acty_group, null);
View myjoin = getLayoutInflater().inflate(R.layout.frame_acty_group,
null);
lv_all = (XListView) all.findViewById(R.id.frame_acty_group_listview);
lv_myjoin = (XListView) myjoin
.findViewById(R.id.frame_acty_group_listview);
adapter_all = new GroupAdapter(data_all);
adapter_myjoin = new GroupAdapter(data_myjoin);
lv_all.setAdapter(adapter_all);
lv_myjoin.setAdapter(adapter_myjoin);
List<View> views = new ArrayList<View>();
views.add(all);
views.add(myjoin);
List<XListView> listviews = new ArrayList<XListView>();
listviews.add(lv_all);
listviews.add(lv_myjoin);
viewpager.setAdapter(new BaseViewPagerAdapter(views,titles));
tabs.setViewPager(viewpager);
tabs.setOnPageChangeListener(new MyOnPageChangeListener(listviews));
}