I want to show the scrollView under the Up and Down button as show in picture. And after taping on up and down arrow scroll bar should be scroll and after long press on the up and down button it should be scrolled continue till the end point. Please tell me how we can Implement this.
Thanks in Advance.
For going to Top you can use the method
For scrolling portions.. basically you can use the function
You can get the current
X, Y
positions bygetScrollX()
andgetScrollY()
and then add some amount to scroll further.Perform
ScrollView .pageScroll()
orScrollView.smoothScrollBy()
on the tap event of the button.Use a Runnable to continues invoke
ScrollView.scrollBy()
when long press event happens. I wrote a demo for you.If you want to detect the scroll state of the ScrollView to enable or disable the buttons, you must write a CustomView to extends ScrollView and override the OnScrollChanged() method.
EDIT: add the layout
EDIT2: If you are using a ListView, you can use
ListView.smoothScrollBy()
to replaceScrollView.scrollBy()
. There is not a pageScroll() method in ListView, write it by yourself, it's not very hard.EDIT3: pageScroll for ListView