I implement circular Auto Horizontal Scroll using HorizontalScollView.
What I did: I added child linear layout, which contain initial default child view let's say 10.
private void startScrolling() {
handler.postDelayed(new Runnable() {
public void run() {
counter = (int) (counter + 10);
handler.postDelayed(this, 100);
viewCount++;
if(viewCount == MAX_CHILD) {
viewCount = 0;
resetViewPosition(0);
}
mScroller.scrollTo(counter , 0);
}
}, 1000L);
}
Now once scrolling start it remove first index view, and add same element at last of view. view keep on scrolling because of timer using postDelay() implementation.
private void resetViewPosition(int viewIndex) {
View view = llParent.getChildAt(viewIndex);
Log.v(TAG, "resetViewPosition : "+view.getId()+", "+llParent.getChildCount());
llParent.removeViewAt(viewIndex);
llParent.addView(view);
}
Issue: ScrollView stopped scrolling after scroll initial element lenth, i.e. it's not expanding with addition new child of linear layout.
Please suggest me what I can do here to implement same.