ViewPager使用DepthPageTransformer时事件会被下一页捕获

在DepthPageTransformer代码中添加如下粗体的代码

}else if(position <=1) {// (0,1]

// Fade the page out.

//页面进入时,使能view

view.setVisibility(View.VISIBLE);

view.setAlpha(1- position);

// Counteract the default slide transition

view.setTranslationX(pageWidth * -position);

// Scale the page down (between MIN_SCALE and 1)

floatscaleFactor =MIN_SCALE

+ (1-MIN_SCALE) * (1- Math.abs(position));

view.setScaleX(scaleFactor);

view.setScaleY(scaleFactor);

//修复一个bug,viewPage后一个界面会与当前页重叠

if(position ==1){

view.setVisibility(View.INVISIBLE);

}

你可能感兴趣的:(ViewPager使用DepthPageTransformer时事件会被下一页捕获)