can we make horizontal scroll view infinte or loop around - android

I want to make horizontal scroll view infinite or atleast give the effect of being infinite.
Any idea how to do so?
can we listen to android horizontal scroll view as to when screen is scrolled.Is there any callback method that is called?
Can we know if the end of scroll has been reached?

Related

ListView scroll to coordinates

I need to scroll list view to some point (e.g. I need to scroll 250px)
I tried next code
container.setAdapter(crewAdapter);
container.scrollTo(0, scroll);
So now it looks good. But when I start scroll by touch scrollview 'jump' to 0 and scroll by finger from top. How to solve it?

Scrollview jumps/repositions when trying to scroll on a clickable child of it

I am using two (embedded) ScrollViews like suggested here, in order to create a '2D Scrollview'.
I add multiple childs to this view, and to some of them I set OnClickListener (I also tried with OnLongClickListener as well).
Functionally the result is what I have expected, although if I try to scroll (starting from a child, that has either of the listeners), the scrollview jumps/repositions to the ~opposite direction, I started the scroll to. So if I scroll like this e.g. upwards, the view jumps a big downwards so that I can scroll up at most to the original position.
I have been trying to play around with calling setFocusable(false) on the childs and setFocusable(true) on the ScrollView(s) (but also tried different permutations of it, as I am not sure about setFocusable()), but couldn't really get on top of it.. Any suggestions?
Just encase you are still wondering this is happening because when you start scrolling the other scroll view, ACTION_CANCEL is posted to the on touch method of the original ScrollView which causes a default scroll view to jump back to its original position.

Animating a View while ListView is scrolling not working

I'm trying to achieve the effect that the Google+ Android app has where there is a View that sits at the bottom of the screen, and when the user scrolls the ListView that sits behind it UP the View animates down, off screen. When the user scrolls the ListView down, even slightly, the View animates back up, on screen.
I've set up a GestureDetector, that is giving me callbacks for the scroll event on my ListView, and the callbacks are constant as I scroll so I know that part is working.
In my callback I'm trying to use the ViewPropertyAnimator to animate my y value as such:
headerView.animate().yBy(distanceY).start();
Nothing happens until I stop scrolling. Is there any way to throw this animation in with the ListView scroll on the UI thread? I get the feeling it's waiting.
I've been fighting this one also. The trick I ended up using was to replace
headerView.animate().yBy(distanceY).start();
with
headerView.setTranslationY(floatValue);
Hope this helps!

Is it possible to auto scroll In Android?

It is possible auto scroll in android? I want my layout to start scrolling when my user loads up the screen, is it possible to do without them having to touch the screen?
I don't think, there is a default method to solve this. However the ScrollView class (you probably need a ScrollView, to make the content scrollable) has a method, which enables you to scroll smooth through the content:
smoothScrollBy(int,int)
the first (x) value is the horizontal, and the second (y) value is the vertical scroll. You could use a background Thread to call this method with the desired parameters, until the end of your ScrollView is reached.

Set scroll range of Android ScrollView

I was wondering if it was possible to set the scroll range of the android ScrollView. Basically I have a scroll view with one child in it that extends 100 pixels past the bottom of the screen. Normally the scroll view will scroll till it gets to the bottom of the child view, is there a way to get the scroll view to stop scrolling like half way and not show the whole child view? I have tried extending ScrollView and overriding the computeVerticalScrollRange() but that did not work. Any help would be appreciated.
Thanks,
Sam
Do you want it to only sometimes scroll to the bottom? Or never at all? In the case of the latter, I would suggest reconsidering your layout and removing that child from the scrollview parent.

Categories

Resources