为Android应用程序嵌入谷歌地图

edd*_*ker 5 android google-maps

嗨,我想在我的应用程序中使用谷歌地图,但我也想为它创建自己的页脚菜单.因此它应该看起来像标题 - 谷歌地图 - 从上到下的页脚.我试图添加relativeLayout和linearLayout嵌入到mapview但我没有实现.

你能给我一个例子或告诉它一些方法吗?

Oll*_*e C 9

阅读布局重量 - http://developer.android.com/guide/topics/ui/layout-objects.html

如果您有三个视图并将权重设置为0,1和0 - 那么中间视图将调整大小,其他两个将保持固定大小,因此这是一个很好的解决方案,用于将页眉和页脚添加到调整大小视图.试试这个模板代码,并注意如何设置布局权重:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

        <!-- Header -->
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
        />

        <!-- Map -->
        <MapView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            ....
        />

        <!-- Footer, or another embedded Layout -->
        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
        />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)