I’m learning animation and scrolling features in android. I have a HorizontalLayout containing
LeniarLayout. Here is my code.
LinearLayout layOut = (LinearLayout)findViewById(R.id.lnLayout);
ImageView im1= new ImageView(this);
im1.setImageResource(R.drawable.im1);
ImageView im2= new ImageView(this);
im2.setImageResource(R.drawable.im2);
ImageView im3= new ImageView(this);
im3.setImageResource(R.drawable.im3);
ImageView im4= new ImageView(this);
im4.setImageResource(R.drawable.im4);
ImageView im5= new ImageView(this);
im5.setImageResource(R.drawable.im5);
ImageView im6= new ImageView(this);
im6.setImageResource(R.drawable.im6);
layOut.addView(im1,0);
layOut.addView(im2,1);
layOut.addView(im3,2);
layOut.addView(im4,3);
layOut.addView(im5,4);
layOut.addView(im6,5);
I’m trying to make these image to autoscroll continously and in definitely.
I looked at Scroller class but it seems only TextView can use Scroller class, since no other class has setScroller method.
What is the other way to achieve continous scrolling for in-definite period of time.
You have two options I can think of. One, draw your images to a
Canvasand fake a scroll movement via theonTouchEventmethod. Then you just draw the images over and over as the user “scrolls.”Edit: removed option 2. That works for vertical scrolling only and I forgot you specified horizontal.