Custom views are designed to be added with the designer. It is however very simple to create a layout file with the custom view and load it multiple times. Tip: remove the call to AutoScaleAll from the designer script. Complete example: Sub Globals Private B4XSwitch1 As B4XSwitch End...
thanks for your response.
pardon me for my ignorance
But does it possible to create an object of Xclv by code not designer(form) and put that on a panel or activity? If the answer is no,can you please explain why?
B4X:
Dim clv As CustomListView
Dim pnl As Panel
clv.Initialize(Me,"clv")
pnl.Initialize("")
Activity.AddView(pnl,0,0,Activity.Width,Activity.Height)
pnl.AddView(clv,0,0,pnl.Width,pnl.Height)
But does it possible to create an object of Xclv by code not designer(form) and put that on a panel or activity? If the answer is no,can you please explain why?
It works, but it is very messy.
I do this exactly the same way in my custom views where I use them.
B4X:
Private Sub ini_xclv
Dim tmplbl As Label
tmplbl.Initialize("")
Dim tmpmap As Map
tmpmap.Initialize
tmpmap.Put("DividerColor",0x00FFFFFF)
tmpmap.Put("DividerHeight",0)
tmpmap.Put("PressedColor",0x00FFFFFF)
tmpmap.Put("InsertAnimationDuration",0)
tmpmap.Put("ListOrientation",m_Orientation)
tmpmap.Put("ShowScrollBar",False)
xclv_main.Initialize(Me,"xclv_main")
xclv_main.DesignerCreateView(mBase,tmplbl,tmpmap)
End Sub