我想将屏幕分成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