Android Question HorizontalScrollView need end scroll event

luciano deri

Active Member
Licensed User
Longtime User
B4X:
Sub PScreen_Touch (Action As Int, x As Float, y As Float)
    Select Action
        Case Activity.ACTION_DOWN
            startscroll = True
    Case Activity.ACTION_UP 'only when make clik
            startscroll = false
     Case 3 'start scroll ?
             .....
   End Select
   
End Sub
Hello everybody. I use HorizontalScroolView for show some page my program, i would like center the page on the screen every times that the user scroll over 50%x, but i dont' know how intercept event when scroll finish.
Thanks. I thinked test the action panel_touch of panel on HorizontalScroolView, but haven't a end_scroll action.
 
Last edited:

luciano deri

Active Member
Licensed User
Longtime User
This event is active every move on scroll, i need intercept when this move is finished and correct the position for centered the panel on screen.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
You could try the attached project.
It does what you want.
It is based on Erels suggestion.
I have added the Touch event for the HorizontalScrollView, there I :
- calculate the approximate time needed to finish the scrolling
- enable a timer with the calculated time
In the Timer_Tick routine I check the ScrollPosition and according to its value set the final position.
I use this method in the ClsWheels Class.
 

Attachments

  • HScrollPages.zip
    7.6 KB · Views: 955
Last edited:
Upvote 0

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
You could try the attached project.
It does what you want.
It is based on Erels suggestion.
I have added the Touch event for the HorizontalScrollView, there I :
- calculate the approximate time needed to finish the scrolling
- enable a timer with the calculate time
In the Timer_Tick routine I check the ScrollPosition and according to its value set the final position.
I use this method in the ClsWheels Class.


Cool I need something like that, but for B4i. What can I use instead of Reflector?
 
Upvote 0
Top