Reputation: 2280
I have seen some tutorials in regards to a table layout in Android, but they were very basic.
My question is that can be be used like html tables are configured. By this I mean, that I can place a table header and then if i need to use to scroll either vertical or horizontal the user can and will always see the header on the top so that the information under it has relevancy to them as they scroll?
Upvotes: 0
Views: 89
Reputation: 10222
No, Android Table layout is very basic in functionality and is not scrollable in itself, you have to wrap it in horizontal and or vertical scrollviews to get it to scroll.
The Table header is always fixed to the top of the table so the scrollviews will scroll it out of view.
There are various ways to fix this.
You can split the header away from the table so that it is not scrolled by the vertical scrollview, there might be various alignment and sizing issues to solve with this.
Some pseudo code below
<LinearLayout>
<HorizontalScrollView>
<HeaderRowTable></HeaderRowTable>
<VerticalScrollView>
<DataTableRows></DataTableRows>
</VerticalScrollView>
</HorizontalScrollView>
</LinearLayout>
There are various ways to do this with recyclerviews but they tend to be only scrollable in one direction.
There are possibly various open source libraries that might help with this.
Two come to mind :-
https://github.com/evrencoskun/TableView
I have contributed to this.
https://github.com/Zardozz/FixedHeaderTableLayout
I am developing this.
Upvotes: 1