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


Java ViewPager.OnPageChangeListener方法代码示例

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


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

示例1: initializeViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initializeViewPager() {
    if (mAlbumFiles != null) {
        if (mAlbumFiles.size() > 3)
            mViewPager.setOffscreenPageLimit(3);
        else if (mAlbumFiles.size() > 2)
            mViewPager.setOffscreenPageLimit(2);
    }

    BasicPreviewAdapter previewAdapter = new AlbumFilePreviewAdapter(getContext(), mAlbumFiles);
    mViewPager.setAdapter(previewAdapter);
    ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            mCurrentItemPosition = position;
            AlbumFile albumFile = mAlbumFiles.get(mCurrentItemPosition);
            mCheckBox.setChecked(albumFile.isChecked());
            mCheckBox.setEnabled(albumFile.isEnable());
            setTitle(mCurrentItemPosition + 1 + " / " + mAlbumFiles.size());

            if (albumFile.getMediaType() == AlbumFile.TYPE_VIDEO) {
                mTvDuration.setText(AlbumUtils.convertDuration(albumFile.getDuration()));
                mTvDuration.setVisibility(View.VISIBLE);
            } else {
                mTvDuration.setVisibility(View.GONE);
            }

            mLayoutLayer.setVisibility(albumFile.isEnable() ? View.GONE : View.VISIBLE);
        }
    };
    mViewPager.addOnPageChangeListener(pageChangeListener);
    mViewPager.setCurrentItem(mCurrentItemPosition);
    // Forced call.
    pageChangeListener.onPageSelected(mCurrentItemPosition);
}
 
开发者ID:WeiXinqiao,项目名称:Recognize-it,代码行数:35,代码来源:AlbumPreviewFragment.java

示例2: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
    mListener = listener;
}
 
开发者ID:fikyair,项目名称:musicplayer,代码行数:5,代码来源:UnderlinePageIndicator.java

示例3: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public void setOnPageChangeListener(final ViewPager.OnPageChangeListener listener) {
    mListener = listener;
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:5,代码来源:CirclePageIndicator.java

示例4: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setOnPageChangeListener(@NonNull ViewPager.OnPageChangeListener listener) {
    mOnPageChangeListener = listener;
}
 
开发者ID:czy1121,项目名称:bannerview,代码行数:4,代码来源:BannerView.java

示例5: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
    mListener = listener;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:4,代码来源:CirclePageIndicator.java

示例6: addOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void addOnPageChangeListener(final ViewPager.OnPageChangeListener onPageChangeListener) {
    if (viewPager == null)
        return;
    viewPager.addOnPageChangeListener(onPageChangeListener);
}
 
开发者ID:kristiyanP,项目名称:anotherViewPager,代码行数:6,代码来源:TabbedViewPager.java

示例7: addOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
 * 添加页面切换的监听事件。
 *
 * @param listener ViewPager页面切换的监听事件
 */
public void addOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
    mViewPager.addOnPageChangeListener(listener);
}
 
开发者ID:wuzhendev,项目名称:android-xgallery,代码行数:9,代码来源:XGallery.java

示例8: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
 * Set a page change listener which will receive forwarded events.
 *
 * @param listener
 */
void setOnPageChangeListener(ViewPager.OnPageChangeListener listener);
 
开发者ID:nelladragon,项目名称:scab,代码行数:7,代码来源:PageIndicator.java

示例9: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
 * Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are
 * required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so
 * that the layout can update it's scroll position correctly.
 *
 * @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
 */
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
    mViewPagerPageChangeListener = listener;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:SlidingTabLayout.java

示例10: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
 * 添加ViewPager滚动监听器
 *
 * @param onPageChangeListener
 */
public void setOnPageChangeListener(ViewPager.OnPageChangeListener onPageChangeListener) {
    mOnPageChangeListener = onPageChangeListener;
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:9,代码来源:BGABanner.java

示例11: setOnPageChangeListener

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {

}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:5,代码来源:TrianglePagerIndicator.java


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