basic4android

fill entire area of tabhost tab with listview programmatically


Is it possible to directly fill a tabhost tab with a listview directly, or should the listview be placed on a panel first. Also, how/what sytax do I use to get the content on the tab to be 100%x and 100%y programmatically?

So in other words - a Tab with a listview on it, but the listview takes up 100%x of the tab, and all of the open space for y (except for the tabs)

Currently each tab is an empty layout file. I want to place content on the layout strictly programmatically if possible.


Solution

  • The above code will add a ListView to a TabHost, the ListView will fill the tab:

    Dim tb As TabHost
    tb.Initialize("")
    Dim lv As ListView
    lv.Initialize("")
    For i = 0 To 10
        lv.AddSingleLine("Item #" & i)
    Next
    tb.AddTab2("Tab1", lv)
    activity.AddView(tb, 0, 0, 300dip, 300dip)