Android Question Standard Page Viewer feature or error?

nibbo

Active Member
Licensed User
Longtime User
Hi All

I am using the standard page viewer to display 'pages' from a catalogue.
Each page can contain up to 6 items and the user is able to swipe the pages left or right.
All good except that when sliding the pages I can see the current page behind the page I am swiping to.
Not a problem if the page is full but when I get to the last page only new entries slide across and I can see the items added to the previous page.
I have not explained this very well so will try to illustrate:

If I have 9 items to be viewed page 1 shows:

1 2 3
4 5 6

All good... however if I then swipe the screen left to move to the next page I see:

7 8 9
4 5 6

Why can I still see 4,5 & 6 when these were panels added to page 1 only?

Thanks in advance for any suggestions...
 

nibbo

Active Member
Licensed User
Longtime User
Hi Erel

I am sure you a right but I cannot see where the problem is.

Here is a simplified loop that has been used to populate the viewer panels.
As you can see from the attachments the problem seems to be that page 1 is always in the back ground!

B4X:
Sub ShowStockItems

    '    initialise a standard page viewer and add it to the main panel
    svpStock.Initialize("svpStock",3,pnlStock.Width,pnlStock.Height-100)
    pnlStock.AddView(svpStock.AsView,0,0,100%x,100%y)
   
    '    set in index to the first page
    Dim iPanel As Int = 0
   
    '    create a panel array to contain details of each stock code
    Dim P(15) As Panel
   
           
    '    panel size and positionaing variables
    Dim iGap As Int = 15
    Dim iPanelHeight As Int = 230
    Dim iPanelWidth As Int = 406
    Dim iPanelTop As Int = iGap
    Dim iPanelLeft As Int = iGap
    Dim iTop As Int = iPanelTop
    Dim iLeft As Int = iPanelLeft

    '    display each stock item
    For i = 0 To 14

        '    initialise the panel
        P(i).Initialize("pStockPanel")
        P(i).Tag=i
       
        '    add it to the view pager
        svpStock.Panels(iPanel).AddView(P(i),iLeft,iTop,iPanelWidth,iPanelHeight)

        '    add a label to see which item this is
        Dim lCode As Label
        lCode.Initialize("")
        lCode.TextSize=50
        lCode.TextColor=Colors.Black
        lCode.text = i
        P(i).AddView(lCode,10dip,10dip,380dip,100dip)

        '    check to see if we are advancing horizontally, starting a new line or starting a new page
        If (i+1) Mod 6 = 0 Then
            '    start a new page
            iTop = iPanelTop
            iLeft = iPanelLeft
            iPanel = iPanel + 1
        Else
            If (i+1) Mod 3 = 0 Then
                '    start new row on current page
                iTop = iTop + iPanelHeight + iGap
                iLeft = iPanelLeft
            Else
                '    position to next horizontal entry
                iLeft = iLeft + iPanelWidth + iGap
            End If
        End If
       
    Next
   
    DoEvents
   
    ProgressDialogHide()

End Sub

The attached shows pages 1 and 2 and as you can see page 1 is visible in the background.
If I move to page 3 page 1 is still visible...

Thanks
 

Attachments

  • Screenshot_2015-03-23-16-55-41.png
    Screenshot_2015-03-23-16-55-41.png
    54.9 KB · Views: 270
  • Screenshot_2015-03-23-16-55-51.png
    Screenshot_2015-03-23-16-55-51.png
    56.7 KB · Views: 281
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Tried all of the above but still no change.
The dip's made no difference and the view pager was already added to the activity in Activity_Create.
Why would it only affect the first panel?
Where is the latest library code as it does not appear in the wiki page?
I am using 1.50, is this the latest version?
Thanks
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
I can be so stupid sometimes.
The code that added the view pager was being executed twice so it actually added two instances of it.
When I scrolled the top view pager it the first one was still visible behind it...
Sorry Erel.
 
Upvote 0
Top