Android Question ListView not using 100%x of ScrollView parent

Alwinl

Member
Licensed User
Longtime User
I have a scroller loaded into an Activity using a layout and sized it using a designer script - all ok.
In code I add a list view manually using the code below:
scroller.Panel.AddView(lv, 0dip, 0dip, 100%x, 100%y)

The listview does not use the '100%' width and heights, only seems to work if I use fixed dip values?
 

Alwinl

Member
Licensed User
Longtime User
Fair enough, here's the code for my activity, screenshot of the designer script/layout attached.

Sub Globals
Dim lv As ListView
Dim scroller As ScrollView
End Sub
Sub Activity_Create(FirstTime AsBoolean)

Activity.LoadLayout("SQLGrid_1")
lv.Initialize("")
'scroller.Panel.AddView(lv, 0dip, 0dip, 100%x, 100%y) 'This does not show a list view at all (I suspect it's size is zero)
scroller.Panel.AddView(lv, 0dip, 0dip, 1000dip, 1000dip) 'This works, but it's a manual size

lv.BringToFront
end sub
 

Attachments

  • Layout.png
    Layout.png
    26.3 KB · Views: 215
Upvote 0

klaus

Expert
Licensed User
Longtime User
You will have trouble with a ListView on a ScrollView.
The scroll events will not work for both.

In your code what value does scroller.Panel.Height have ?
Depending on this height you may not see the complete ListView.

Best regards.
 
Upvote 0

Alwinl

Member
Licensed User
Longtime User
I don't what happened but now it seems to display fine, the code is the same except for the logging code I added for Klaus. Sorry guys I can't explain this one.
 
Upvote 0
Top