Search code examples
androidtablerowandroid-tablelayoutsectionheadertableheader

TableLayout with fixed section header and scrollable


I am trying to create a view like this:

Table layout

...that has two fixed headers. Whole table layout is scrollable and inner table view is also scrollable as shown in image. Headers and data are dynamic. And when I scroll up to header-2 it hides items of header-1 not header-1.


Solution

  • I can explain how you can accomplish it easily without using ListView. For less amount of data you should not use ListView it will affects your efficiency.

    Step 1 :

    Make use of weight attribute and give equal half for two header

    Step 2:

    Headers name be static , create one TableLayout inside Scroll View

    Step 3:

    Create TableRow as dynamic is separate or in same Layout and dynamically add Table row into the TableLayout.

    Repeat the same for the Second Header you will get.

    For Dynamic TableLayout check this link