test123123
test123123

Reputation: 921

Vertical Split Layout Android

I want to have a layout that is split in two parts vertical . My App is always in landscape mode.

Please help.

I tried it with a tablelayout.

 <TableLayout android:id="@+id/tableLayout1" 
 android:stretchColumns="*" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
 <TableRow android:id="@+id/tableRow1"
 android:layout_width="fill_parent" android:layout_height="wrap_content">
 </TableRow>
 </TableLayout>

Upvotes: 2

Views: 3419

Answers (2)

Filippo Mazza
Filippo Mazza

Reputation: 4377

I'll use Egor's solution but also nest everything inside a RelativeLayout just in case you would like to add a title in another LinearLayout (this way you can add a android:below on the other container)

Upvotes: 1

Egor
Egor

Reputation: 40218

I'm not a fan of TableLayout, so I'll try to explain you how to achieve this by using the LinearLayout. You need to set your layout's orientation to horizontal using android:orientation="horizontal". Then you should create two LinearLayouts inside, both having android:layout_width="fill_parent" and android:layout_weight="1". Then you can put anything inside these layouts, and the whole view will be split in two horizontal parts. Hope this helps!

Upvotes: 6

Related Questions