You can easily replicate that behavior by extending the HorizontalScrollView
widget and drawing two properly placed images/drawables:
public class CustomHorizontalScrollView extends HorizontalScrollView {
private static final int SHADOW_WIDTH = 35;
private GradientDrawable mDrawableLeft;
private GradientDrawable mDrawableRight;
private Rect mBounds = new Rect();
public CustomHorizontalScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
mDrawableLeft = new GradientDrawable(Orientation.LEFT_RIGHT,
new int[] { Color.GRAY, Color.TRANSPARENT });
mDrawableRight = new GradientDrawable(Orientation.RIGHT_LEFT,
new int[] { Color.GRAY, Color.TRANSPARENT });
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
// the scroll value
final int offset = this.getScrollX();
mBounds.setEmpty();
mBounds.bottom = getMeasuredHeight();
// check made to remove the shadow if we are at the left edge of the
// screen so we don't interfere with the edge effect
if (offset != 0) {
// left drawable
mBounds.left = offset;
mBounds.right = offset + SHADOW_WIDTH;
mDrawableLeft.setBounds(mBounds);
mDrawableLeft.draw(canvas);
}
// check made to remove the shadow if we are at the right edge of the
// screen so we don't interfere with the edge effect
if ((offset + getMeasuredWidth()) < computeHorizontalScrollRange()) {
// right drawable
mBounds.left = offset + getMeasuredWidth() - SHADOW_WIDTH;
mBounds.right = offset + getMeasuredWidth();
mDrawableRight.setBounds(mBounds);
mDrawableRight.draw(canvas);
}
}
}