如何在FrameLayout(android)中设置mapview下的按钮?

如何在FrameLayout(android)中设置mapview下的按钮?,android,android-layout,Android,Android Layout,我有地图视图和图像在它的中心-一切都在框架布局内。这是全屏的。现在我想在这个地图视图下有一些按钮,但我不知道如何设置它 另外,我希望imageview位于mapview的中心 如何重建它 main.xml的代码: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="ve

我有地图视图和图像在它的中心-一切都在框架布局内。这是全屏的。现在我想在这个地图视图下有一些按钮,但我不知道如何设置它

另外,我希望imageview位于mapview的中心

如何重建它

main.xml的代码:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 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:apiKey="---key---"
    android:clickable="true" >
</com.google.android.maps.MapView>

    <ImageView
        android:id="@+id/test_image"
        android:layout_width="50px"
        android:layout_height="50px"
        android:layout_gravity="center"
        android:src="@drawable/srodek" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</FrameLayout>

我希望这个透明按钮是我的地图视图下的普通按钮:)谢谢

现在我想在这个地图视图下有一些按钮,我 我不知道怎么把它放在下面

不能使用
FrameLayout
,因为它不允许子对象相对于彼此放置(它只允许子对象相对于父对象的边放置),而是使用
RelativeLayout

<RelativeLayout fill_parent/fill_parent>

   <Button android:id="@+id/btn" wrap_conntent/wrap_content   
       android:layout_alignParentBottom="true" />

   <FrameLayout height="wrap_content" width="fill_parent" 
       android:above="@id/btn" android:alignParentTop="true">
         <MapView  fill_parent/fill_parent/>
         <ImageView wrap_content/wrap_content android:layout_gravity="center"/>
   </FrameLayout>

</RelativeLayout> 

您可以将当前框架布局插入另一个相对布局中

<?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="wrap_content" >
    <View
        android:id="@+id/d1"
        android:layout_width="40dp"
        android:layout_height="10dp"
        android:layout_gravity="left|center_vertical|center_horizontal"
        android:padding="3dp" 
        />
    <FrameLayout
        android:id="@+id/flayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/button1"
        android:layout_below="@id/d1"
        android:orientation="vertical" >
        <com.google.android.maps.MapView
            android:id="@+id/mapview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:apiKey="--key--"
            android:clickable="true" >
        </com.google.android.maps.MapView>
        <ImageView
            android:id="@+id/test_image"
            android:layout_width="50px"
            android:layout_height="50px"
            android:layout_gravity="center"
            android:src="@drawable/ic_launcher" />
    </FrameLayout>
    <Button
        android:id="@id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" 
        android:layout_alignParentBottom="true"/>
</RelativeLayout>


嘿,谢谢你的关注。但是地图视图仍然是全屏的,唯一改变的是trasnaprent按钮在地图的底部。@pawel Yeap这不起作用,我被迷住了。看来,缩短
地图视图
以容纳下面的
按钮
的唯一方法是使用权重:嘿,谢谢你的兴趣。但是mapview仍然是全屏的,唯一改变的是trasnaprent按钮位于地图的底部。尝试更改框架布局的布局高度以包装内容