Android Question ASViewPager Library (Smoother Scrolling Transition) (SOLVED)

walterf25

Expert
Licensed User
Hi All, i am using this very nice Library found here I see that is based on a CustomListView, I was wondering if there is a way to add smoother scrolling transition when going from page to another.

What I'm doing is that I am disabling the finger swipe feature and adding a button so that the user can go from one page to another, this is just the way the app i'm working on requires it.
When I enable the finger swipe I see the transition from page to the next is very nice and smooth, but If I do it by clicking on the Next button and executing AsViewPager1.NextPage then I really don't like the transition very much, it is way too fast and sometimes it gets confusing sometimes as i do not see the smooth transition.

Anyway of adding a smooth transition by code when switching pages horizontally and by clicking on a button rather than by finger swiping?

Thanks all.
Walter
 

Alexander Stolte

Expert
Licensed User
this very nice Library found here
thanks! :)
AsViewPager1.NextPage
is based on .ScrollToItem.
I add a "NextPage2" this is based on a timer, please try it.
B4X:
Public Sub NextPage2
    If (current_index +1) < xclv_main.Size Then
        PageChangeEvent(current_index +1)
        tmr_main.Initialize("tmr_main",1)
        tmr_main.Enabled = True
    End If
End Sub
Private Sub tmr_main_Tick
    Dim tmp As Int = mBase.Width * current_index   
    If xclv_main.sv.ScrollViewOffsetX = tmp Then
        tmr_main.Enabled = False
        Else
        xclv_main.sv.ScrollViewOffsetX = xclv_main.sv.ScrollViewOffsetX + 5
    End If   
End Sub
 

Attachments

walterf25

Expert
Licensed User
thanks! :)

is based on .ScrollToItem.
I add a "NextPage2" this is based on a timer, please try it.
B4X:
Public Sub NextPage2
    If (current_index +1) < xclv_main.Size Then
        PageChangeEvent(current_index +1)
        tmr_main.Initialize("tmr_main",1)
        tmr_main.Enabled = True
    End If
End Sub
Private Sub tmr_main_Tick
    Dim tmp As Int = mBase.Width * current_index  
    If xclv_main.sv.ScrollViewOffsetX = tmp Then
        tmr_main.Enabled = False
        Else
        xclv_main.sv.ScrollViewOffsetX = xclv_main.sv.ScrollViewOffsetX + 5
    End If  
End Sub
Very nice, thank you, I will also go ahead and add the PreviousPage2 using another timer as well.

Thanks,
Walter
 

FHEBERT

Member
Licensed User
Hello,
I have a problem with the horizontal seekbar and the horizontal Asview. I can't change value with the finger. I sweep always on a other page.
Is it possible to lock the horizontal scrolling ?
 
Top