2011-06-17 130 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添加标题(这样你就可以添加一个机器人:下面的其他容器)