当前位置: 首页>>代码示例>>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;未经允许,请勿转载。