Android Question TableView example - loading to Panel

Arf

Well-Known Member
Licensed User
Longtime User
I adapted Klaus's TableExample project
https://www.b4x.com/android/forum/threads/gridline-in-tableview-using-scrollview.7684/#post-43670
and took out the populate from CSV part, and use it to load results into a table. Seems to work, so I now need to display the table in a small portion of screen rather than full screen.

I put a panel (TablePanel) in with the Designer and size this to a small area in the designer scripts.
I put the scrollview (ResultsTabel) in the designer as a Child of TablePanel.
Then in ActivityCreate I do the following:
B4X:
TablePanel.AddView(ResultsTable,TablePanel.Left, TablePanel.Top, TablePanel.Width, TablePanel.Height)

Some of the table is displayed, but not across the full width of the panel. Also, the header row seems to go up out of the panel for some reason.
I will continue trying to fix it, but is my strategy generally correct to display the table? I was hoping for it to fill the entire panel I made.
 

Arf

Well-Known Member
Licensed User
Longtime User
It seems that when I load the table to a panel, the header is always drawn with reference to the Activity and not the panel.
Here's a screenshot of the top bit of my screen in portait mode, the header is at 0,0 while the rest of the table is in the panel that was supposed to be home to it.

screenie_zpsm1zjszjx.jpg
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Nevermind, I found it. A, 'Activity.Addview' was still urking in the header drawing bit :)
 
Upvote 0
Top