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>
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!
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)
精彩评论