While working on a little game to learn more about Intents, Activity life cycle and other stuff, I used the TableLayout for the first time. I realized that the auto-completion missed the attribute android:layout_span which is referred by the R.attr. The same with android:stretchColumns. As I read some minutes ago, some people still think column span is not possible – so I decided to publish a sample to prove them wrong.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!-- snipped -->
<TableLayout android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:stretchColumns="*">
    <TableRow>
        <TextView android:id="@+id/info"
            android:layout_span="3"
	    android:text="@string/info"
	    android:layout_gravity="center_horizontal" />
	</TableRow>
    <TableRow>
	    <Button android:id="@+id/button_add" android:text="+" />
	    <TextView android:text="@string/label" />
	    <TextView android:id="@+id/amount" />
    </TableRow>
<!-- snipped -->
</TableLayout>
<!-- snipped -->

If the auto-completion leaves out an attribute, there can be more attributes being unsupported, so always use the API as cross reference!

  • Share/Bookmark