Android Question How to scroll ScrollView by code

JNG

Member
Licensed User
Hi

I want to scroll scrollview by code.
e.g. I have 10 panels in scroll view and by disabling the internal scroll property of scrollview I want to scroll according to need at which panel it should jump.

disabling the touch is ok but moving around by code I am not finding any solution. p-l. suggest.
regards
jng
 

klaus

Expert
Licensed User
Longtime User
You have two methods:
ScrollPosition = xx smoth scrolling
ScrollToNow(xx) fast scrolling
I haven't tested it when scrolling is disabled.
But you can enable scrolling just before the code scroll and disable scrolling just after the scroll.
 
Upvote 0

JNG

Member
Licensed User
Thanks I will give a try today it means I have to store the top position of each panel and then scroll according to the requirement. Anything related to this code will help
more.

regards
jng
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I have to store the top position of each panel...
It depends on the height of the panels.
If all panels have the the same height you can mutiliply the panel index by the panel height.
Otherwise yes, you need to memorize the top values of the panels.
 
Upvote 0

JNG

Member
Licensed User
Its working
now how can I limit the scroll between two positions.
and enable the scroll between these position and deactivate the touch event of the scrollview

regards
jng
 
Upvote 0

JNG

Member
Licensed User
this is the requirement in my project because instead of creating four to five activities for this work I want to cover in one. Because my internal panels are of different height. to show the information I need to catch this event.
 
Upvote 0

JNG

Member
Licensed User
Hi!

Its a information getting activity in which depending upon different selection I want to show different information in the panels and on selection I finally asked user to enter some information. This can be done in four to five activities but to avoid this I am using scrollview to achieve it. As you suggested every thing is working fine only now I want to catch the following
how can I limit the scroll between two positions.
and enable/disable the scroll between these position and deactivate/activate the touch event of the scrollview

scrolled change position need to be controlled.
 
Last edited:
Upvote 0
Top