I am having a brain fart at the moment. I have a listview that I add the first line with lvWhatever.addsingleline("Add New") and then I run a for loop to get results from the db.
That all works perfectly but the issue I have is setting the total height of the listview. If it only has the Add New line and 2 lines from the db, I don't want it taking up the whole screen . On the other hand if it has 40 records, I only want it to cover 90%y of the screen.
You want the ListView to "grow" depending on the number of records and if reaches 40 + size it to 90%y?, why not just sizing the ListView as ListView1.Height = 90%y
The example I gave was only an example, not an actual listview so there is a little more to it but here is a screenshot when I use that line.
There are only 3 records so it has a lot of blank space at the bottom. I would rather use a spinner but to get a tablet to show on the play store, the targetsdk needs to be set at 11 and for some reason, my spinners don't show on anything above 10
Then calculate the desired listview's height by multiplying label's height by the size of your list. If it's greater than 90% then set it to that, as NJDude previously suggested.
That is what I am trying to figure out and where I am having a brain fart.
I can't seem to figure out how to word this line:
(lvheight is a variable that contains dbcursor.rowcount * the label height of 60dip)
lvSearch.Height = lvheight + 120 & "dip"
if lvheight = 3 then the height of the list view will be 3 * 60 = 180dip, but you will have to also keep an eye on the height of the device's screen or your ListView will be outside the visible area.