1

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.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
CoDe
  • 11,056
  • 14
  • 90
  • 197
  • 1
    Following our chat discussion and for logging purposes : https://code.google.com/p/infinite-gallery/ – g00dy Jul 26 '13 at 13:10
  • Try this: http://stackoverflow.com/questions/4720469/horizontalscrollview-auto-scroll-to-end-when-new-views-are-added – Sheetal Suryan Sep 18 '14 at 12:27
  • thanks ..will try it..and since question asked long before so not sure where I need it :) – CoDe Sep 18 '14 at 12:36

1 Answers1

0

Try using Gallery, i think it will work fine with your needs

HatemTmi
  • 1,068
  • 9
  • 16
  • 1
    gallery was an option to palce content horizontaly...but when u talk auto about scrolling...it give bad experience..i tried this before. – CoDe Jul 26 '13 at 12:13