As shown here you can use image views to get custom scroll bar like effect.
The layout XML for custom progress bar in that example is:
And then he creates a list of images in class file as:
/**
* Loads the layout and sets the initial set of images
*/
private void prepareLayout() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.myprogressbar, null);
addView(view);
imageHolders = new ArrayList();
imageHolders.add((ImageView) view.findViewById(R.id.imgOne));
imageHolders.add((ImageView) view.findViewById(R.id.imgTwo));
imageHolders.add((ImageView) view.findViewById(R.id.imgThree));
// Prepare an array list of images to be animated
images = new ArrayList();
images.add("progress_1");
images.add("progress_2");
images.add("progress_3");
images.add("progress_4");
images.add("progress_5");
images.add("progress_6");
images.add("progress_7");
images.add("progress_8");
images.add("progress_9");
}
Then he starts a Thread that sleeps for 0.3 seconds and calls the handler with handler.sendEmptyMessage(0);
and finally in Handler he do the rest of the work of images:
@Override
public void handleMessage(Message msg) {
int currentImage = 0;
int nextImage = 0;
// Logic to change the images
for (ImageView imageView : imageHolders) {
currentImage = Integer.parseInt(imageView.getTag().toString());
if (currentImage < 9) {
nextImage = currentImage + 1;
} else {
nextImage = 1;
}
imageView.setTag("" + nextImage);
imageView.setImageResource(getResources().getIdentifier(
images.get(nextImage - 1), "drawable",
"com.beanie.example"));
}
super.handleMessage(msg);
}
Also take a look at here and here.