我想將屏幕分成2個部分。以上部分是一個地圖小部件。以下是其他佈局填充小部件。問題是地圖部件填滿了整個屏幕。我怎樣才能使地圖推入地圖下的佈局?Android佈局優先
我猜這可以通過給地圖小部件一個高度來解決,但這不是很靈活。
我學嘗試:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:apiKey="my api key" />
<RelativeLayout
android:id="@+id/map_menu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/mapview"
android:background="@drawable/locatie_background" >
<Button android:id="@+id/firstButtonId" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/action_ready"
/>
</RelativeLayout >
</RelativeLayout>
在RelativeLayout中試試這個:android:layout_weight =「1」。我認爲它會解決你的問題 – 2011-03-31 11:48:56
@Kartik不,它不會。 'RelativeLayout'忽略'layout_weight'。 – 2011-03-31 11:52:48
感謝您的提示。試圖改變到父佈局linearLayout,所以我可以分配一個權重到第二個相對佈局。但它給出了相同的結果 – Vincent 2011-03-31 11:54:10