MapView底部带有按钮

时间:2011-04-17 14:51:31

标签: 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/map" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:apiKey="mykey"
        android:clickable="true" />

    <Button android:id="@+id/button" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentBottom="true" />


</RelativeLayout>

这种方法效果很好,但按钮覆盖在mapview的顶部。我希望mapview在按钮顶部结束。我以为我可以将mapview设置为layout_height =“wrap_content”,但这不起作用。

有什么建议吗?

2 个答案:

答案 0 :(得分:3)

显然我只需要将它添加到我的MapView:

android:layout_above="@+id/button"
    android:layout_alignParentTop="true"

答案 1 :(得分:1)

jst添加代码: 机器人:layout_alignParentTop = “真”

相关问题