0
我包括layout.xml:如何將一個包含ListView的RelativeLayout與另一個兩邊的RelativeLayout水平對齊?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@color/grey" >
<RelativeLayout
android:id="@id/layout_content_magthumb"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@color/grey" >
<ImageView
android:id="@id/content_thumb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_large"
android:src="@drawable/cover1" />
</RelativeLayout>
<RelativeLayout
android:id="@id/layout_content_list"
android:layout_width="100dp"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/layout_content_magthumb"
android:layout_toLeftOf="@id/layout_content_description"
android:background="@color/yellow" >
<ListView
android:id="@id/list_content"
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
</ListView>
</RelativeLayout>
<RelativeLayout
android:id="@id/layout_content_description"
android:layout_width="wrap_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/darker_gray" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_large"
android:src="@drawable/cover2" />
</RelativeLayout>
</RelativeLayout>
,我面對的是,每當我包括佈局ListView中它佔據了整個版面,但對於離開的RelativeLayout佈局空間的問題。
請建議。
對不起@code詩人這是行不通的。 – Debopam 2012-07-10 07:39:05
您可以嘗試使用「LinearLayout」,其方向爲'horzontal',重量如上所述。幾天前我遇到了同樣的問題,並發現這對我有用。 – 2012-07-10 07:42:46
嗯,我找到了一種方式 - – Debopam 2012-07-10 07:51:54