I have this TableLayout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout" android:layout_height="fill_parent"
android:layout_alignParentBottom="true" android:scrollbars="horizontal|vertical"
android:layout_width="fill_parent" android:scrollbarStyle="outsideInset">
<HorizontalScrollView android:id="@+id/horizontalView" android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TableLayout android:id="@+id/reportTableLayout"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="1">
</TableLayout>
</HorizontalScrollView>
</ScrollView>
I have set all layout_width to fill_parent, and yet my Table columns don’t seem to stretch and fill the rest of the width space. There is still a margin on the left, but I want my table to stretch over the complete width of the screen. Any ideas? Thanks.
If you only have one column,
android:stretchColumns="1"won’t do anything, because the number represents the index of the column to stretch (with 0 being the index of the first column). Try usingandroid:stretchColumns="*"EDIT: thinking about this a little more, I doubt
fill_parentwill actually have any effect on thehorizontalScrollView. Because the view is infinitely scrollable in the horizontal direction, I don’t think android takes thelayout_widthinto account unless it is a hard-coded value. You can try setting thelayout_widthto the same size as your screen (maybe get the width of your screen and set it as a minimum width in code?).