3

Like the title says, how do I make a looping scrollview? :)

In other words, when you scroll to the bottom, the scrollview should not stop and continue in the same speed from the top seamless! hope someone knows this!

Alioooop
  • 465
  • 4
  • 12
  • There is nothing built into Android for this. You will need to create your own custom `View` class, unless somebody else has already written one for you. – CommonsWare May 09 '11 at 11:09
  • The easiest way I can think of is duplicating the content (vertically), then once the user hits the second content block just translate the ScrollView up by the height of a content block. (Although you'd sort of need to have 3 content blocks for it to work scrolling upwards, and in this case you'd need to start them looking at the middle block) – Joseph Earl May 09 '11 at 11:11
  • @CommonsWare I know that it isnt anything for this in the sdk. @Joseph Yes I have thought of that but I think that its a pretty dirty solution... maybe somebody knows a better way :) – Alioooop May 09 '11 at 13:28
  • The loop as you want we can work with ListView easy. But with ScrollView i think we can be do by this way: 1. Add triple view that you want to loop in a ViewGroup as LinearLayout (orient vertical) . 2. Override onScrollChanged() to detect when scroll to third subview of viewgroup, at that point, we remove firstview ( have been invisible) then add that view to bottom of groupview – mdtuyen Nov 25 '15 at 13:01
  • You can modified this for it: http://stackoverflow.com/questions/10316743/detect-end-of-scrollview – mdtuyen Nov 25 '15 at 13:07

1 Answers1

0

If you can afford to use a listView instead of a scrollView, there is a library that can turn it into a circular listView :

Circular list adapter for Android's ListView. This adapter makes your existing list adapter appear circular and possibly infinite unless you scroll down through two billion list items ;). Works with list adapters that you already have. No project specific dependencies. Just include the latest jar or the sources to your Android project.

Update: Ooh I just noticed you asked this way back in 2011. Guess you have figured it out by now. Anyway, I'll leave this here.

ShahiM
  • 3,068
  • 1
  • 27
  • 54