use of androidx.viewpager2.widget.CompositePageTransformer in project banner by youth5201314.
the class Banner method init.
private void init(Context context) {
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop() / 2;
mCompositePageTransformer = new CompositePageTransformer();
mPageChangeCallback = new BannerOnPageChangeCallback();
mLoopTask = new AutoLoopTask(this);
mViewPager2 = new ViewPager2(context);
mViewPager2.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mViewPager2.setOffscreenPageLimit(2);
mViewPager2.registerOnPageChangeCallback(mPageChangeCallback);
mViewPager2.setPageTransformer(mCompositePageTransformer);
ScrollSpeedManger.reflectLayoutManager(this);
addView(mViewPager2);
mRoundPaint = new Paint();
mRoundPaint.setColor(Color.WHITE);
mRoundPaint.setAntiAlias(true);
mRoundPaint.setStyle(Paint.Style.FILL);
mRoundPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mImagePaint = new Paint();
mImagePaint.setXfermode(null);
}
Aggregations