MapView如何填充完整的父容器?

时间:2013-04-29 10:59:23

标签: android

有以下简单的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.google.android.maps.MapView
        android:id="@+id/activityMainPoints"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:apiKey="0JsSnv022MOCCXMAJfsQTVtfCiH37VG5XykFLmQ"
        android:clickable="true" />

</RelativeLayout>

正如您所看到的,MapView必须填充完整的父容器RelativeLayout,但事实并非如此!我该如何解决?

2 个答案:

答案 0 :(得分:0)

android:layout_width="fill_parent"
android:layout_height="fill_parent"

答案 1 :(得分:0)

试试这个:

 <?xml version="1.0" encoding="utf-8"?>
    <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activityMainPoints"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="0JsSnv022MOCCXMAJfsQTVtfCiH37VG5XykFLmQ"
        android:clickable="true"
        />