I am using following code to create a TableLayout
which is scrollable horizontally:
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="200dp"
android:scrollbars="none">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/maintable2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="*"
android:background ="#dddddd"
android:scrollbars="none" >
</TableLayout>
</HorizontalScrollView>
I need the columns in the TableLayout
to at least fill the screen (i.e. if there is only one column, the borders of that columns should stretch over the whole screen, if there are two columns, the borders of both columns should fill the screen etc.).
How can I do that?
I had the same problem. I solved it by adding android:fillViewport="true"
to the HorizontalScrollView
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With