如何在谷歌地图上添加布局?

时间:2015-08-18 14:24:18

标签: android google-maps android-layout

在我的应用程序中有一个谷歌地图,当用户点击一个图钉时,一个特定的布局将显示与SncakBar完全相同,布局包含一些按钮和TextViews。请帮助我如何在谷歌地图上添加布局。 主要布局的XML文件:

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

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ToolBarStyle"
    android:id="@+id/toolbar_actionbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:elevation="12dp"
    android:minHeight="@dimen/abc_action_bar_default_height_material" />

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/toolbar_actionbar">

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:clickable="true"
        android:layout_height="match_parent" >
    </FrameLayout>

    <!--&lt;!&ndash; android:layout_marginTop="?android:attr/actionBarSize"&ndash;&gt;-->
    <fragment android:id="@+id/fragment_drawer"
        android:name="com.example.muhammad.shopplus.NavigationDrawerFragment"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:layout="@layout/fragment_navigation_drawer" />

    <FrameLayout
        android:id="@+id/container_"
        android:layout_width="match_parent"
        android:clickable="true"
        android:layout_height="match_parent" >
    </FrameLayout>

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />


</android.support.v4.widget.DrawerLayout>

提前致谢。

1 个答案:

答案 0 :(得分:2)

您可以使用Framelayout或当前布局内部在屏幕底部创建额外的布局。一开始,它将是隐形的。当用户按某处时,它将在底部显示。这是我的建议。你可以试试它是否有用。