I'm using horizontalscrollView along with the animation to move set of
images as a slideshow. I'm able to move the images from right to left
using the following code :
public void getScrollMaxAmount(){
int actualWidth =
(horizontalOuterLayout.getMeasuredWidth()-512);
//int actualWidth = (horizontalOuterLayout.getScrollX()-512);
scrollMax = actualWidth;
}
public void startAutoScrolling(){
if (scrollTimer == null) {
scrollTimer = new Timer();
final Runnable Timer_Tick = new Runnable() {
public void run() {
moveScrollView();
}
};
if(scrollerSchedule != null){
scrollerSchedule.cancel();
scrollerSchedule = null;
}
scrollerSchedule = new TimerTask(){
@Override
public void run(){
runOnUiThread(Timer_Tick);
}
};
scrollTimer.schedule(scrollerSchedule, 30, 30);
}
}
public void moveScrollView(){
//scrollPos = (int)
(horizontalScrollview.getScrollX() + 1.0);
scrollPos = (int)
(horizontalOuterLayout.getMeasuredWidth() -
1.0);
if(scrollPos >= scrollMax){
scrollPos = 0;
}
/*if(scrollPos <= scrollMax){
scrollPos = 0;
}*/
horizontalScrollview.scrollTo(scrollPos, 0);
//horizontalScrollview.scrollTo(0,scrollPos);
}
I now want to move the images from right to left as a slideshow. I'm
unable to find the right formula/logic. Kindly assist me. :(
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en