當前位置: 首頁>>代碼示例>>Java>>正文


Java PageTransformer類代碼示例

本文整理匯總了Java中android.support.v4.view.ViewPager.PageTransformer的典型用法代碼示例。如果您正苦於以下問題:Java PageTransformer類的具體用法?Java PageTransformer怎麽用?Java PageTransformer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PageTransformer類屬於android.support.v4.view.ViewPager包,在下文中一共展示了PageTransformer類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setPageTransformer

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
/**
 * Set a {@link PageTransformer} that will be called for each attached page whenever
 * the scroll position is changed. This allows the application to apply custom property
 * transformations to each page, overriding the default sliding look and feel.
 *
 * <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
 * As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p>
 *
 * @param reverseDrawingOrder true if the supplied PageTransformer requires page views
 *                            to be drawn from last to first instead of first to last.
 * @param transformer PageTransformer that will modify each page's animation properties
 */
// Compat Here...
public void setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) {
    /*if (Build.VERSION.SDK_INT >= 11) */{
        final boolean hasTransformer = transformer != null;
        final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
        mPageTransformer = transformer;
        setChildrenDrawingOrderEnabledCompat(hasTransformer);
        if (hasTransformer) {
            mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
        } else {
            mDrawingOrder = DRAW_ORDER_DEFAULT;
        }
        if (needsPopulate) populate();
    }
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:28,代碼來源:ViewPagerCompat.java

示例2: initialize

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
private void initialize()
{
  setPageTransformer$382b7817(new ViewPager.PageTransformer()
  {
    public final void transformPage(View paramAnonymousView, float paramAnonymousFloat)
    {
      if ((paramAnonymousFloat < 0.0F) || (paramAnonymousFloat >= 1.0F))
      {
        paramAnonymousView.setTranslationX(0.0F);
        paramAnonymousView.setAlpha(1.0F);
        paramAnonymousView.setScaleX(1.0F);
        paramAnonymousView.setScaleY(1.0F);
        return;
      }
      paramAnonymousView.setTranslationX(-paramAnonymousFloat * paramAnonymousView.getWidth());
      paramAnonymousView.setAlpha(Math.max(0.0F, 1.0F - paramAnonymousFloat));
      float f = Math.max(0.0F, 1.0F - 0.3F * paramAnonymousFloat);
      paramAnonymousView.setScaleX(f);
      paramAnonymousView.setScaleY(f);
    }
  });
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:23,代碼來源:PhotoViewPager.java

示例3: initConvenientBanner

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
public void initConvenientBanner() {
    showView(mConvenientBanner);

    //  mConvenientBanner.setManualPageable(false); // 設置不能手動影響,其實就是不能手動滑動,不能按住暫停滾動

    ArrayList<Integer> localImages = new ArrayList<>();
    for (int position = 0; position < 4; position++)
        localImages.add(getResId("ic_banner_" + position, R.mipmap.class));

    mConvenientBanner.setPages(new CBViewHolderCreator<LocalImageHolderView>() {
        @Override
        public LocalImageHolderView createHolder() {
            return new LocalImageHolderView();
        }
    }, localImages)
            // 設置兩個點圖片作為翻頁指示器,不設置則沒有指示器,可以根據自己需求自行配合自己的指示器,不需要圓點指示器可以不設
            .setPageIndicator(new int[]{R.mipmap.ic_page_indicator, R.mipmap.ic_page_indicator_focused});
    // .setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT) // 設置指示器的位置,可左可右,目前居中
    //  .setOnPageChangeListener(this)// 監聽翻頁事件
    // .setOnItemClickListener(this) // 監聽圖片的點擊事件

    try {
        // 設置翻頁動畫
        PageTransformer pageTransformer = TRANSFORM_CLASSES.get(CURRENT_TRANSFORMER).clazz.newInstance();
        mConvenientBanner.getViewPager().setPageTransformer(true, pageTransformer);
        // 這個3D特效需要調整滑動速度
        if (pageTransformer.toString().equals("StackTransformer")) {
            mConvenientBanner.setScrollDuration(1200);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:35,代碼來源:HomeFragment.java

示例4: setPageTransformer

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
/**
 * Sets a {@link PageTransformer} that will be called for each attached page whenever
 * the scroll position is changed. This allows the application to apply custom property
 * transformations to each page, overriding the default sliding behavior.
 *
 * <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
 * As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.
 *
 * @param reverseDrawingOrder true if the supplied PageTransformer requires page views
 *                            to be drawn from last to first instead of first to last.
 * @param transformer PageTransformer that will modify each page's animation properties
 */
public void setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) {
    if (Build.VERSION.SDK_INT >= 11) {
        final boolean hasTransformer = transformer != null;
        final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
        mPageTransformer = transformer;
        setChildrenDrawingOrderEnabledCompat(hasTransformer);
        if (hasTransformer) {
            mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
        } else {
            mDrawingOrder = DRAW_ORDER_DEFAULT;
        }
        if (needsPopulate) populate();
    }
}
 
開發者ID:joy-inc,項目名稱:core-ui,代碼行數:27,代碼來源:VerticalViewPager.java

示例5: setPageTransformer

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
/**
 * Set a {@link ViewPager.PageTransformer} that will be called for each attached page whenever
 * the scroll position is changed. This allows the application to apply custom property
 * transformations to each page, overriding the default sliding look and feel.
 * <p/>
 * <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
 * As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no
 * effect.</p>
 *
 * @param reverseDrawingOrder true if the supplied PageTransformer requires page views
 *                            to be drawn from last to first instead of first to last.
 * @param transformer         PageTransformer that will modify each page's animation properties
 */
public void setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) {
    if (Build.VERSION.SDK_INT >= 11) {
        final boolean hasTransformer = transformer != null;
        final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
        mPageTransformer = transformer;
        setChildrenDrawingOrderEnabledCompat(hasTransformer);
        if (hasTransformer) {
            mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
        } else {
            mDrawingOrder = DRAW_ORDER_DEFAULT;
        }
        if (needsPopulate) populate();
    }
}
 
開發者ID:FolioReader,項目名稱:FolioReader-Android,代碼行數:28,代碼來源:VerticalViewPager.java

示例6: setPageTransformer

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
/**
 * Set a {@link PageTransformer} that will be called for each attached page whenever
 * the scroll position is changed. This allows the application to apply custom property
 * transformations to each page, overriding the default sliding look and feel.
 *
 * <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
 * As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p>
 *
 * @param reverseDrawingOrder true if the supplied PageTransformer requires page views
 *                            to be drawn from last to first instead of first to last.
 * @param transformer PageTransformer that will modify each page's animation properties
 */
public void setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) {
    if (Build.VERSION.SDK_INT >= 11) {
        final boolean hasTransformer = transformer != null;
        final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
        mPageTransformer = transformer;
        setChildrenDrawingOrderEnabledCompat(hasTransformer);
        if (hasTransformer) {
            mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
        } else {
            mDrawingOrder = DRAW_ORDER_DEFAULT;
        }
        if (needsPopulate) populate();
    }
}
 
開發者ID:jnagels,項目名稱:Vertical-ViewPager,代碼行數:27,代碼來源:VerticalViewPager.java

示例7: TransformerItem

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
public TransformerItem(Class<? extends PageTransformer> clazz) {
    this.clazz = clazz;
    title = clazz.getSimpleName();
}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:5,代碼來源:HomeFragment.java

示例8: setPageTransformer

import android.support.v4.view.ViewPager.PageTransformer; //導入依賴的package包/類
/**
 * 自定義翻頁動畫效果
 *
 * @param transformer
 * @return
 */
public ConvenientBanner setPageTransformer(PageTransformer transformer) {
    viewPager.setPageTransformer(true, transformer);
    return this;
}
 
開發者ID:HanyeeWang,項目名稱:GeekZone,代碼行數:11,代碼來源:ConvenientBanner.java


注:本文中的android.support.v4.view.ViewPager.PageTransformer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。