I implement an code to perform Auto HorizontalScrolling using View.scrollTo(...) and postDelay timer to keep scrolling continue.
to start Scrolling I am using :
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);
}
llParent.scrollTo(counter , 0);
}
}, 1000L);
}
At last I remove every first view and add it at again, so simply it goes at last and appear as new child using:
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: In this process initially for some of view it function properly but soon next child not visible. Still adding/remove process running and I am getting index id in resetViewPosition(..) properly. It just child view are not drawing.
Please suggest me how can I add and display view while parent view scrolling?