adding a listview to a panel array

Smee

Well-Known Member
Licensed User
Longtime User
I am trying to add a listview to a particular panel in an array

I am using the sliding panels example as a base

Code: Copy
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout

can anyone advise how to add the listview?

Thanks

Joe
 
When you add it you have to know the specific panel number:
panels(3).addview(listview,left,top,width,height)
 
Upvote 0
Thanks for the reply Derez,

I tried the following

Code: Copy
Dim lvCustomers As ListView
....
....



   panels(1).AddView("lvCustomers",0, 0, 100%x, 100%y)

but i get the following error

B4A line: 58
panels(1).AddView(\
javac 1.6.0_22
src\anywheresoftware\b4a\samples\slidingpanels\main.java:267: inconvertible types
found : java.lang.String
required: android.view.View
_panels[(int)(1)].AddView((android.view.View)("lvCustomers"),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(100),mostCurrent.activityBA));
^
1 error

Where am i going wrong?

thanks

UPDATED:

BUGGGER i used quotation marks by mistake
 
Last edited:
Upvote 0
Hi Klaus,

So far this is what I have

Code: Copy
Dim lvCustomers As ListView
Dim panels(8) As Panel
   
   For i = 0 To panels.Length - 1
      panels(i).Initialize("panels")
      Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout
      panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
   Next

lvCustomers.Initialize("lvCustomers")
panels(1).AddView(lvCustomers,0, 0, 100%x, 100%y)
panels(0).LoadLayout("menu")
NewBitmap1.Initialize(File.DirAssets,"menu.jpg")
panels(0).SetBackgroundImage(NewBitmap1)
 
Upvote 0
Yes it works now except for the loading of the background. I posted a new question on this

panels(0).LoadLayout("menu")
NewBitmap1.Initialize(File.DirAssets,"menu.jpg")
panels(0).SetBackgroundImage(NewBitmap1)

The bal file loads but the background does not show
 
Upvote 0
Back
Top