Android Question How change color when sliding viewpager

devmobile

Active Member
Licensed User
I understood that exist below event for AHViewPager
B4X:
sub EventName_PageScrolled (Position As Int, PositionOffset as Float, PositionOffsetPixels as Int)
I want to change color when user scrolling pager
But for each scroll i need change color looklike some app
How do it?
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
B4X:
vp_PageChanged (Position As Int)
    pc.GetPageAt(Position).Panel.Color = yourcolor
End Sub

Vp is your pageviewer, pc page container
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
Another way, that i used in my app, is declare a global array of color, with the same size of pages.

B4X:
VP_PageChanged (Position As Int)
TabLayout.Color = CColor(Position)
End Sub
 
Upvote 0

devmobile

Active Member
Licensed User
B4X:
vp_PageChanged (Position As Int)
    pc.GetPageAt(Position).Panel.Color = yourcolor
End Sub

Vp is your pageviewer, pc page container
I know this my friend
I want to change color from page1 to page2 dynamic
Example page1 is red and page2 blue
When i scroll from page1 to page2 i want to change from red to blue slowly
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…