2011-06-17 141 views
2

我想要有一個垂直分割爲兩部分的佈局。我的應用程序始終處於橫向模式。垂直分割佈局Android

請幫忙。

我試着用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> 
+0

你能發佈你的代碼? – 2011-06-17 08:41:04

+0

我試着用tablelayout。但我做不到。我應該看起來像[| ] – test123123 2011-06-17 08:43:25

回答

6

我不是TableLayout風扇,所以我會盡力解釋你如何使用LinearLayout實現這一目標。您需要使用android:orientation="horizontal"將佈局的方向設置爲水平。那麼你應該創建兩個LinearLayouts裏面,都有android:layout_width="fill_parent"android:layout_weight="1"。然後,您可以將任何內容放入這些佈局中,並且整個視圖將分成兩個水平部分。希望這可以幫助!

+0

如果你還想使用TableLayout,請查看[this](http://developer.android.com/guide/tutorials/views/hello-tablelayout.html)教程,也許你可以將它調整到你的應用程序。 – iDroid 2011-06-17 09:01:23

1

我將使用葉戈爾的解決方案,而且還窩在心裏一RelativeLayout,以防萬一你想在另一LinearLayout添加標題(這樣你就可以添加一個機器人:下面的其他容器)