Too late for you, but may be helpful to others.
To do this, you can create a custom view. Just scale the original bitmap so that it is as tall as your image and then draw it several times on the canvas:
public class RepeatingXImageView extends View { Bitmap bitmap; Paint paint; public RepeatingXImageView(Context context) { super(context); } public RepeatingXImageView(Context context, AttributeSet attrs) { super(context, attrs); } public RepeatingXImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if(changed) { paint = new Paint(); bitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.seekbar_overlay); bitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth(), bottom - top, false); } } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if(bitmap == null) return; int left = 0; while(left < getWidth()) { canvas.drawBitmap(bitmap, left, 0, paint); left += bitmap.getWidth(); } } }
Graeme
source share