-1

How would I go about creating the following layout using tablelayout? Column spanning is straightforward, but I haven't found any clear guidance on row spanning.

enter image description here

Mattia
  • 47
  • 1
  • 9

1 Answers1

2

You cannot do this directly, but will have to use nested layouts instead. In your case, using nested TableLayouts will be very inefficient though, so you should use a combination of other layouts.

Try something like:

LinearLayout with vertical orientation (1)
  LinearLayout with a horizontal orientation (2)
    Box like view + LinearLayout with vertical orientation (3)
                      Row 1
                      LinearLayout with horizontal orientation (4)
                        The Two Views
                      Row 3
  Your other large view
  Your other other large View

Here's a color coded version of your layout (each color is a new parent Layout)

enter image description here

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • Why inefficient? There's a way to do it by nesting TableLayout? – Mattia Apr 06 '13 at 18:59
  • 1
    @Mattia TableLayouts themselves are nested LinearLayouts. By using the flow I described, you are nesting fewer layouts. So using a TableLayout nest for this will be less efficient than the multiple LinearLayout nest I've provided. – Raghav Sood Apr 06 '13 at 19:00
  • what is the "Box like view" element? – Mattia Apr 07 '13 at 18:17
  • @Mattia Whatever your top right corner view is, which you've shaped like a box. – Raghav Sood Apr 07 '13 at 19:13