我以爲我已經理解Android的XML佈局,但似乎我沒有。 我想在一個屏幕上有四個ImageViews,可以同時查看四個圖像。Android XML佈局 - 在一個屏幕上的4個ImageView
它應該是這樣的,其中A至d表示圖像的觀點:
DDDAAA
DDDAAA
BBBCCC
BBBCCC
我怎麼能這樣做?我試過這種方式,但它不起作用。 Eclipse編輯器似乎對此也不太好。有更好的創建這些佈局嗎?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow>
<ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:layout_width="wrap_content" ></ImageView>
<ImageView android:id="@+id/ImageView02" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
</TableRow>
<TableRow>
<ImageView android:id="@+id/ImageView03" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
<ImageView android:id="@+id/ImageView04" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
</TableRow>
</RelativeLayout>
很酷!這正是我所尋找的。我不知道LinearLayout的垂直和水平選項,因爲我使用的編輯器很難在我看來使用。非常感謝:) – Nils 2010-06-21 19:48:39
不客氣:-)玩得開心! – 2010-06-21 19:49:14