对于 HorizontalScrollView,如果它的宽度大于它的子视图,它就不会滚动,所以没有边缘效果。你可以试试这个来增加反弹效果。
public class OverScrollHorizontalScrollView extends HorizontalScrollView {
...
public OverScrollHorizontalScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
setOverScrollMode(OVER_SCROLL_ALWAYS);
}
...
@Override
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY,
int scrollRangeX, int scrollRangeY, int maxOverScrollX,
int maxOverScrollY, boolean isTouchEvent) {
maxOverScrollX = 90; // this is the rebound distance, set yours
return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY,
maxOverScrollX, maxOverScrollY, isTouchEvent);
}
...
}