本文整理汇总了Java中android.support.v4.view.ViewPager.SimpleOnPageChangeListener类的典型用法代码示例。如果您正苦于以下问题:Java SimpleOnPageChangeListener类的具体用法?Java SimpleOnPageChangeListener怎么用?Java SimpleOnPageChangeListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleOnPageChangeListener类属于android.support.v4.view.ViewPager包,在下文中一共展示了SimpleOnPageChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViewPager
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initViewPager() {
this.mViewPager.setOffscreenPageLimit(5);
this.mViewPager.setAdapter(new ArrayPagerAdapter(getSupportFragmentManager(), this
.mContentFragments, this.mTitles));
this.mSlidingTab.setViewPager(this.mViewPager);
this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
if (position == 1 && AddFoodListActivity.this.mFavoriteFragment.isFirstLoad) {
MobclickAgent.onEvent(AddFoodListActivity.this.ctx, Event
.TOOL_FOODANDSPORT_FAVORITETAB);
AddFoodListActivity.this.mFavoriteFragment.firstLoad();
} else if (position == 2 && AddFoodListActivity.this.mCustomFoodFragmennt
.isFirstLoad) {
MobclickAgent.onEvent(AddFoodListActivity.this.ctx, Event
.TOOL_FOODANDSPORT_MINETAB);
AddFoodListActivity.this.mCustomFoodFragmennt.firstLoad();
} else if (position == 3 && AddFoodListActivity.this.mUploadFoodFragment
.isFirstLoad) {
AddFoodListActivity.this.mUploadFoodFragment.firstLoad();
} else if (position == 4 && AddFoodListActivity.this.mCookFoodFragment
.isFirstLoad) {
AddFoodListActivity.this.mCookFoodFragment.firstLoad();
}
}
});
}
示例2: init
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void init() {
if (getIntent() == null) {
finish();
return;
}
this.mCurrentIndex = getIntent().getIntExtra(KEY_INDEX, 0);
this.mPhotoList = getIntent().getParcelableArrayListExtra(KEY_WEIGHT_PHOTOS);
if (this.mPhotoList == null || this.mPhotoList.size() == 0) {
finish();
return;
}
this.mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), this.mPhotoList);
this.viewpager.setAdapter(this.mAdapter);
this.viewpager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
NewWeightGalleryActivity.this.mCurrentIndex = position;
NewWeightGalleryActivity.this.setCurrentItem();
}
});
setCurrentItem();
}
示例3: addListener
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void addListener() {
this.mPullListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
ShopMainFragment.this.requestShopHomePages();
}
});
this.mPullListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
public void onLastItemVisible() {
if (ShopMainFragment.this.mPage > ShopMainFragment.this.mCurrentPage &&
ShopMainFragment.this.hasMore) {
ShopMainFragment.this.mCurrentPage = ShopMainFragment.this.mPage;
ShopMainFragment.this.requestShopHomeMoreGoods();
}
}
});
this.mIndicator.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
super.onPageSelected(position);
ShopMainFragment.this.mCurrentIndex = position;
}
});
}
示例4: initView
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initView() {
initFragments();
this.adapter = new CollectionPagerAdapter(getSupportFragmentManager(), this.fragmentList);
this.viewpager.setAdapter(this.adapter);
this.viewpager.setOffscreenPageLimit(2);
this.slidingTabs.setViewPager(this.viewpager);
this.slidingTabs.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
if (position == 1 && MyFavoriteActivity.this.webFavoriteFragment != null &&
MyFavoriteActivity.this.webFavoriteFragment.isFirstLoad()) {
MyFavoriteActivity.this.webFavoriteFragment.pullToRefresh();
MyFavoriteActivity.this.webFavoriteFragment.setIsFirstLoad(false);
}
super.onPageSelected(position);
}
});
}
示例5: initView
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initView() {
if (this.mentionList != null && this.mentionList.size() != 0) {
this.pagerAdapter = new MentionPreviewPagerAdapter(getSupportFragmentManager(), this
.mentionList);
this.viewPager.setAdapter(this.pagerAdapter);
this.viewPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
super.onPageSelected(position);
MentionPreviewActivity.this.videoView.stopPlayback();
MentionPreviewActivity.this.currentMention = (Mention) MentionPreviewActivity
.this.mentionList.get(position);
MentionPreviewActivity.this.setCurrentIndex(position);
}
});
this.viewPager.setCurrentItem(this.position);
setCurrentIndex(this.position);
}
}
示例6: initActionbar
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initActionbar() {
View view_tab = LayoutInflater.from(this).inflate(R.layout.h1, null);
this.mSlidingTab = (PagerSlidingTabStrip) view_tab.findViewById(R.id.sliding_tabs);
LayoutParams layoutParams = new LayoutParams(-2, -1);
layoutParams.gravity = GravityCompat.END;
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setCustomView(view_tab, layoutParams);
this.mSlidingTab.setViewPager(this.viewpager);
this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
super.onPageSelected(position);
if (position == 1 && !GoodsDetailActivity.this.isSecondLoad) {
GoodsDetailActivity.this.goodsPostsFragment.loadFirst();
GoodsDetailActivity.this.isSecondLoad = true;
}
}
});
}
示例7: initListener
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initListener() {
findViewById(R.id.back_iv).setOnClickListener(this);
this.mDownloadIv.setOnClickListener(this);
this.mContentHvp.addOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
MQPhotoPreviewActivity.this.renderTitleTv();
}
});
}
示例8: initListener
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initListener() {
findViewById(R.id.back_iv).setOnClickListener(this);
this.mSubmitTv.setOnClickListener(this);
this.mChooseTv.setOnClickListener(this);
this.mContentHvp.addOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
MQPhotoPickerPreviewActivity.this.handlePageSelectedStatus();
}
});
}
示例9: setListener
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
protected void setListener() {
this.mContentVp.addOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
for (int i = 0; i < MQEmotionKeyboardLayout.this.mIndicatorIvList.size(); i++) {
((ImageView) MQEmotionKeyboardLayout.this.mIndicatorIvList.get(i)).setEnabled
(false);
}
((ImageView) MQEmotionKeyboardLayout.this.mIndicatorIvList.get(position))
.setEnabled(true);
}
});
}
示例10: initViewPager
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initViewPager() {
this.mViewPager.setOffscreenPageLimit(this.mTitles.length);
this.mViewPager.setAdapter(new ArrayPagerAdapter(getSupportFragmentManager(), this
.mContentFragments, this.mTitles));
this.mSlidingTab.setViewPager(this.mViewPager);
this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
if (position == 1 && AddSportListActivity.this.mCustomSportFragment.isFirstLoad) {
AddSportListActivity.this.mCustomSportFragment.firstLoad();
}
}
});
}
示例11: initView
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initView() {
this.scrollview.setOnRefreshListener(new OnRefreshListener<ScrollView>() {
public void onRefresh(PullToRefreshBase<ScrollView> pullToRefreshBase) {
BetFragment.this.loadData();
}
});
this.tipsIndicator.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
super.onPageSelected(position);
BetFragment.this.currentItem = position;
}
});
ViewUtils.setViewScaleHeight(getActivity(), this.ivBetTop, 750, 250);
}
示例12: addListener
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void addListener() {
this.scrollView.setOnRefreshListener(new OnRefreshListener<ScrollView>() {
public void onRefresh(PullToRefreshBase<ScrollView> pullToRefreshBase) {
NewPartnerFragment.this.initUI();
}
});
this.indicator.setOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
super.onPageSelected(position);
NewPartnerFragment.this.mCurrentItem = position;
}
});
}
示例13: onActivityCreated
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
this.mTabLayout = ((MainActivity) getActivity()).getPartnerTab();
this.mTitleList.add("精选");
this.mTitleList.add("好友圈");
this.mFabButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (!PartnerFragment.this.isDetached()) {
new BuilderIntent(PartnerFragment.this.getActivity(), StatusPostTextActivity
.class).startActivity();
}
}
});
this.mAdapter = new PartnerFragmentAdapter(getActivity().getSupportFragmentManager());
this.mFragmentList.add(new PartnerDiscoverFragment());
this.mFragmentList.add(new HomeTimelineFragment());
this.mViewPager.setAdapter(this.mAdapter);
this.mViewPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
PartnerFragment.this.mCache.put(CacheKey.HOME_STATUS_TAB, String.valueOf(position));
}
});
this.mTabLayout.setupWithViewPager(this.mViewPager);
this.mTabLayout.setTabMode(1);
EventBus.getDefault().register(this);
this.mViewPager.post(new Runnable() {
public void run() {
try {
PartnerFragment.this.mViewPager.setCurrentItem(Integer.parseInt
(PartnerFragment.this.mCache.getAsString(CacheKey.HOME_STATUS_TAB)));
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
示例14: setImage
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
public void setImage(ArrayList<Integer> imageList) {
for (int i = 0; i < imageList.size(); i++) {
Integer imageID = ((Integer) imageList.get(i)).intValue();
ImageView iv = new ImageView(mContext);
iv.setLayoutParams(new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
iv.setScaleType(ImageView.ScaleType.FIT_XY);
iv.setImageResource(imageID);
iv.setOnClickListener(this);
mViewList.add(iv);
}
mPager.setAdapter(new ImageAdapater());
mPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
setButton(position);
}
});
mCount = imageList.size();
for (int i = 0; i < mCount; i++) {
RadioButton radio = new RadioButton(mContext);
radio.setLayoutParams(new RadioGroup.LayoutParams(dip_15, dip_15));
radio.setGravity(Gravity.CENTER);
radio.setButtonDrawable(R.drawable.indicator_selector);
mGroup.addView(radio);
}
mPager.setCurrentItem(0);
setButton(0);
}
示例15: initViewPager
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initViewPager() {
mViewPager.setPageMargin(UIUtils.dip2px(10));
mViewPager.setPageMarginDrawable(new ColorDrawable(0x00FFFFFF));
mAdapter = new HomePagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mAdapter);
mViewPager.setOnPageChangeListener(new SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
mTabView.switchButton(position == 0);
}
});
}