Android布局wrap_content填充父级

时间:2013-03-20 14:01:00

标签: android android-layout

我有这个布局: 它应该有一个底部有容器的mapview,这个容器有一个广告和两个按钮,背景为黄色。 相反,我只看到屏幕上填充了广告和屏幕底部的两个按钮的容器。

xml的根:(不知何故,它不显示stackoverflow上的根)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>

XML:

<RelativeLayout
    android:id="@+id/bottomcontainer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/yellow" >

    <LinearLayout
        android:id="@+id/action"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_margin="0dp"
        android:gravity="center_horizontal"
        android:orientation="horizontal"
        android:padding="0dp" >

        <Button
            android:id="@+id/bt_map"
            style="@style/ButtonLeft"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="8dp"
            android:enabled="false"
            android:gravity="center"
            android:minWidth="100dp"
            android:padding="8dp"
            android:text="Map" />

        <Button
            android:id="@+id/list"
            style="@style/ButtonRight"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="8dp"
            android:gravity="center"
            android:minWidth="100dp"
            android:padding="8dp"
            android:text="List" />
    </LinearLayout>

    <com.google.ads.AdView
        android:id="@+id/adview"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_above="@id/action"
        ads:adSize="BANNER"
        ads:adUnitId="unitId"
        ads:loadAdOnCreate="true" />
</RelativeLayout>

<com.google.android.gms.maps.MapView
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:apiKey="apikey"
    android:clickable="true"
    map:uiZoomControls="false"
    android:layout_above="@id/bottomcontainer" >
</com.google.android.gms.maps.MapView>

<ImageButton
    android:id="@+id/bt_location"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_margin="10dp"
    android:src="@android:drawable/ic_menu_mylocation" />

<ListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/yellow"
    android:layout_above="@id/bottomcontainer"
    android:visibility="gone" >
</ListView>

0 个答案:

没有答案