abduaziz8988
Member
how to save a listview with all the data (AddTwoLinesAndBitmap2) I will be very grateful for your help
just understand that it is not possible to add a custom listview to AH Page Container gives an error I do not know whyHi
If I understand correctly, you want to put data in a listview.
Listview is not a good solution. Use xCustomListView
[B4X] [XUI] xCustomListView - cross platform CustomListView
Update: As several other libraries depend on xCustomListView library, it is no longer recommended to use the code module. Use the library instead. There are several extension classes that add more features to xCLV. They are listed at the end of this post. Video tutorial: xCustomListView is...www.b4x.com
A little more detail would help for better help.
container.AddPage(CustomListView1.AsView,"Все")
here is an example. A small part of the project cannot be added. If it doesn't work out, I'll throw the project to youThere are parameters that have not been defined. It can't work
Can you post a project to clearly see what is wrong
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Dim lviz As ListView
Private xui As XUI
Dim TYPE_HELLO_WORLD As Int : TYPE_HELLO_WORLD = 1
Dim TYPE_SETTINGS As Int : TYPE_SETTINGS = 2
Dim TYPE_LISTVIEW As Int : TYPE_LISTVIEW = 3
Dim FILL_PARENT As Int : FILL_PARENT = -1
Private ime As IME
Dim WRAP_CONTENT As Int : WRAP_CONTENT = -2
Public Page2 As moddaho
Dim container As AHPageContainer
Dim pager As AHViewPager
'Optionally you can use an AHViewPagerTabs object as a page indicator
Dim tabs As AHViewPagerTabs
'This panel is just for a colored line between the tabs and the pages.
Dim line As Panel
Dim la As CustomListView
Private CustomListView1 As CustomListView
End Sub
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
B4XPages.GetManager.TransitionAnimationDuration=0
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.SetVisibleAnimated(0,True)
'Add a Button at the bottom of the page for jumping directly to a page.
Root.LoadLayout("1")
container.Initialize
For i = 0 To 1
Dim pan As Panel
Select i
Case 0
pan = CreatePanel(TYPE_HELLO_WORLD, "Избранное")
container.AddPage(pan,"Избранное " )
Case 1
pan = CreatePanel(TYPE_SETTINGS, "Все")
container.AddPage(pan,"Все")
End Select
Next
index = SearchView1.SetItems(cities)
index = SearchView1.SetItems(cities)
'Now we have a container with our panels just add it to the pager object
pager.Initialize2( container,"Pager")
pager.PagingEnabled=True
'As we want to show the tabs page indicator, we initialize it
tabs.Initialize(pager)
tabs.LineHeight = 10dip
tabs.UpperCaseTitle = True
Root.AddView(tabs, 0, 54dip, FILL_PARENT, WRAP_CONTENT)
'We add a line below the tab page indicator because it looks good
Dim col As ColorDrawable
col.Initialize(tabs.LineColorCenter, 0)
line.Initialize("")
line.Background=col
Root.AddView(line, 0, 54dip+35dip, Root.Width, 1dip)
'Now we can add the pager to the activity
Root.AddView(pager, 0, 54dip+35dip + 2dip, Root.Width, Root.Height-48dip-35dip-2dip)
End Sub
Sub CreatePanel(PanelType As Int, Title As String) As Panel
Dim pan As Panel
Dim pan2 As Panel
Dim aq As Map
pan2.Initialize("")
pan2.LoadLayout("MainPage")
Dim pi As PanelInfo
Dim list1 As List
pi.Initialize
pi.LayoutLoaded = False
pi.PanelType = PanelType
pan.Initialize("")
Select PanelType
Case TYPE_HELLO_WORLD
lviz.Initialize("lviz1")
pan.AddView(lviz, 0, 0, FILL_PARENT, FILL_PARENT)
Case TYPE_SETTINGS
CustomListView1.Initialize("","")
pan.AddView(CustomListView1.AsView, 0, 0, 100%x, 100%y)
End Select
pan.Tag = pi
Return pan
End Sub
it just can't be added to the AH Page Container if you know the code, please writeYou can always add CLV. You are doing something wrong.
Case TYPE_SETTINGS
CustomListView1.Initialize("","")
pan.AddView(CustomListView1.AsView, 0, 0, 100%x, 100%y)
Should be:
Case TYPE_SETTINGS
private p as b4xview = xui.createpanel("p")
p.setLayoutAnimated(0,0,0,100%x,100%y)
p.loadlayout("LayoutwithCLVonly") ' Make sure you set the anchors to cover the complete page
pan.addview(p,0,0,100%x,100%y)