Android Question CustomListView in CustomListView

frenkipi

Member
Licensed User
Longtime User
Hello,

I have a customlist view, containing my cellitems which are label and webview. And on top of that I have a panel containing image slider. I can scroll on my customlistview just fine. Now I have to create all these items scrolable. So my panel with image slider and my customlistview.

Bellow is my code for cellItem

B4X:
Sub CreateListItem(Text As String, Url As String, Width As Int, Height As Int) As Panel

    Dim p As Panel
   
    p.Initialize("")
    'we need to add the panel to a parent to set its dimensions. It will be removed after the layout is loaded.
    Activity.AddView(p, 0, 0, Width, Height)
    p.LoadLayout("CellItem")
    p.RemoveView
   
    WebView1.LoadHtml("<html><body><img src='"&Url&"'></body</html>")
    'Button1.Text = "Click"
    Label1.Text = Text

    Return p
   
End Sub

Sub clv2_AddItems
        Panel1.Visible=True
        ''Log("AddItems")
   Dim currentNumberOfItems As Int = clv2.GetSize
   Dim job As HttpJob    
  job.Initialize("getjson", Me)
  Starter.csu.CallSubPlus("Main", job.Download("Url") , 3000)    

End Sub

and for my slider in activity_create

B4X:
Panel2.AddView(Slider,0dip,0dip,100%x,30%y)

What will be the best way to achieve that?

Regads!
 

frenkipi

Member
Licensed User
Longtime User
Ok, or it will be maybe better to add image slider on the first place of the clv and then use cellitem?

Regards!
 
Upvote 0

frenkipi

Member
Licensed User
Longtime User
OK, here is my layout 1, in panel2 I have an image slider, and in clv2-customlistview I have my cell item layout 2nd image bellow. Now what will be the best way that panel2 can scroll with clv2. So lets say panel2 will be on the first place of cellitem layout.

Regards!

together
layout1.png


layout2.png
 
Upvote 0

frenkipi

Member
Licensed User
Longtime User
this is how I implement my image slider

B4X:
Slider.Initialize("Slider")  
    Panel2.AddView(Slider,0dip,0dip,100%x,30%y)
    Slider.AddSlide("text", "urlimage")
   
    Dim filelist As List = File.ListFiles(File.DirDefaultExternal  )
  
    For Each fi As String In filelist
        Dim path As String =File.Combine(File.DirDefaultExternal  , fi)
        If fi.LastIndexOf (".JPG")>0 Or fi.LastIndexOf (".png")>0  Then       
            Slider.AddSlide(fi , "file:" & path )
           
        End If
      
    Next
    Slider.SetTransition(Slider.SLIDER_TRANSITION_FlipPage)
   
    Slider.Delay=12000
    Slider.Start

Now I need to add it on the first place of the customlistview...
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Yes, but the problem is, that I have my cellitem for infinite scroll, I am allways adding new cellitem
Does the image slider have to be IN the clv ? Cannot it be placed above / at the top of the clv ?
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
This might help you to achieve your goal .. Just use your code above to add the Slider into Panel2 .. where commented.
it was too much hassle setting up ImageSlider lib so it has not been tested thoroughly as to functionality ...
 

Attachments

  • AllScrollable Test.zip
    20.9 KB · Views: 157
Upvote 0
Top