I have a TableLayout which is populated dynamically with many rows of data. It contains more data than the screen can hold, so I require it to be scrollable.
My issue is that when I place the TableLayout inside of a ScrollView, it appears to cut off many rows from the top of the TableLayout.
For reference, the full code is here (the question is to cluttered already to fit it all) http://pastebin.com/w7Fi3Bzz
See below for the code related to the issue I'm having
Here is the XML without the ScrollView:
<TableLayout
android:orientation="vertical"
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:id="@+id/tbl_statistics"
android:stretchColumns="*"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
>
</TableLayout>
And what it looks like:
And here is the same XML with an enclosing ScrollView:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<TableLayout
android:orientation="vertical"
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:id="@+id/tbl_statistics"
android:stretchColumns="*"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
>
</TableLayout>
</ScrollView>
And here is what the table looks like, you can see the top of the table was truncated (it is populated with the same exact data):
I found a similar issue here LinearLayout not expanding inside a ScrollView, but the answers did not help me.