Help with listview within scrollview ?

dealsmonkey

Active Member
Licensed User
Longtime User
Hi,

I am trying to put a listview within a scrollview. I have a for loop that iterates through my json data, this is working fine.

The problem is that if I initialize the listview outside of the for-loop I get an error about the child view already existing and I need to use removeview.

If I initialize the listview within the for-loop, the error message disappears, the listview looks fine and responds to item_click, however the value returned is always the last item added to the listview.

Please could someone point me in the right direction, before I pull what hair I have left out :sign0104:

The reason I am using a scrollview is I am using a webview as well to show a web image, without downloading it first

Neil
 
While you can put a ListView inside a ScrollView, it will not behave properly as both views are scrollable.

Oh, that's not what I wanted to hear :BangHead:

Back to the listview method then, unless there is another way ??

Thanks for the reply Erel.

Neil
 
Upvote 0
Quick update. Thanks evryone for your input. I am loving b4a, just getting to grips with the syntax.

To solve my problem, I have attached a tag to the panel, then using the code from the scrollview example, added labels for the info fields. To get the panel pressed, I just use the panel_click sub and get the sender, then retrieve the tag. Works like a charm !!
 
Upvote 0
I'd post my code for others to learn, but my variable names give away the app function !!

I'll rewrite it if anyone is interested.

Neil
 
Upvote 0
Back
Top