當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。