iOS Question Problem iSideMenu / CustomListView ?

MarcoRome

Expert
Licensed User
Hi All.
I have iSideMenu and a CustomListView.
Now if i add iSideMenu with this code in Sub Show

B4X:
If pg.IsInitialized = False Then
        pg.Initialize("pg")
        pg.RootPanel.Color = Colors.Black
        pg.RootPanel.LoadLayout("lay_home")
        pg.Title = "XXXXXXX"
    End If
    Main.NavControl.ShowPage(pg)
    Main.NavControl.ToolBarVisible = True
    
    'InizializzoToastMessage
    dt.Initialize(pg,17,True)
    
    'Full screen
    Main.NavControl.ToolBarVisible = False
    Main.NavControl.SetNavigationBarVisibleAnimated(False)
    Dim no As NativeObject = App
    no.RunMethod("setStatusBarHidden:animated:", Array(True, False))
    SetStatusBarStyleLight
    
    'Creo SideMenu
    Dim nc As NavigationController
    nc.Initialize("nc")
    Main.NavControl = nc
    Dim lp As Page
    lp.Initialize("lp")
    lp.RootPanel.Color = Colors.Red
    lp.RootPanel.LoadLayout("lay_home_ordini")

    smc.Initialize(lp, nc, Null)
    App.KeyController = smc
    nc.ShowPage(pg)
    Dim b1 As BarButton
    b1.InitializeBitmap(KeepOriginalColors(LoadBitmap(File.DirAssets, "cart.png")), "left")
    pg.TopLeftButtons = Array(b1)
i have this result as Customlist
upload_2018-3-1_14-53-50.png


the resize does not occur

if i work without iSidemenu i have correct result:

upload_2018-3-1_14-55-28.png


Any idea
Thank you
Marco
 

MarcoRome

Expert
Licensed User
Hi @Erel, here a little example.

I understand what happens, if you have a query to be made to populate the Customlistview, it causes this problem, it is not the query itself for itself but the delay.
If the operation does not take place immediately, this effect is obtained
In the example i entered a simple sleep, and we get exactly the same problem.
 

Attachments

Erel

Administrator
Staff member
Licensed User
1. Tip:
B4X:
Dim p As Panel
   p.Initialize("")
   #if B4A
   p.SetLayout(0, 0, Width, Height)
   #else if B4i
   p.SetLayoutAnimated(0, 1, 0, 0, Width, Height) 'set the size before the layout is loaded
   #End If
Replace it with:
B4X:
Dim p As Panel = XUI.CreatePanel("")
 p.SetLayoutAnimated(0, 0, 0, Width, Height)
2. See this video:


The only place where you can safely use percentage units is inside the page resize event.
I don't think that the height in this case should depend on the page height at all. It should probably be 180dip.
 
Top