解决滑动时候,流畅的大小变化,重写LinearLayoutManager; @Override
public int scrollVerticallyBy(int dy, recycler, state) {
int orientation = getOrientation();
if (orientation == VERTICAL) {
int scrolled = (dy, recycler, state);
float midpoint = getHeight() / ;
float d0 = ;
float d1 = mShrinkDistance * midpoint;
float s0 = ;
float s1 = - mShrinkAmount;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
float childMidpoint =
(getDecoratedBottom(child) + getDecoratedTop(child)) / ;
float d = (d1, (midpoint - childMidpoint));
float scale = s0 + (s1 - s0) * (d - d0) / (d1 - d0);
(scale);
(scale);
}
return scrolled;
} else {
return 0;
}
}
@Override
public int scrollHorizontallyBy(int dx, recycler, state) {
int orientation = getOrientation();
if (orientation == HORIZONTAL) {
int scrolled = (dx, recycler, state);
float midpoint = getWidth() / ;
float d0 = ;
float d1 = mShrinkDistance * midpoint;
float s0 = ;
float s1 = - mShrinkAmount;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
float childMidpoint =
(getDecoratedRight(child) + getDecoratedLeft(child)) / ;
float d = (d1, (midpoint - childMidpoint));
float scale = s0 + (s1 - s0) * (d - d0) / (d1 - d0);
(scale);
(scale);
}
return scrolled;
} else {
return 0;
}
}