It may be common instinct for you to place a horizontal line in a TableLayout within the TableRow tags. However, when I did try that, the horizontal line never stretched to fill the whole width.

The trick is not to place the View tag inside the TableRow tag but outside of it. See example below.

Setting a View like an ImageView or TextView within a TableRow spanning N number of columns can be done within the XML layout file using the android:layout_span attribute in the View object, not the TableRow.

Check out the sample xml code below. Since the second row contains 3 columns with 3 different ImageView objects and the first row contains only one ImageView, the android:layout_span is called to span the first row with 3 columns.

Related Posts Plugin for WordPress, Blogger...