2016-11-24 58 views
1

我有一個佈局:我的工具欄覆蓋我的地圖

<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context="sdfsf.MainActivity"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 

</android.support.design.widget.AppBarLayout> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    app:srcCompat="@android:drawable/ic_dialog_email" /> 

<fragment 
    android:layout_width="match_parent" 
    android:layout_height="45dp" 
    android:id="@+id/map" 
    tools:context="com.example.app.MapLocationActivity" 
    android:name="com.google.android.gms.maps.SupportMapFragment"/> 

<include layout="@layout/content_main" /> 

當我創建我的谷歌地圖的樣子工具欄上的地圖和隱藏頂部區域。但我想在可見區域顯示地圖。如何在我的@ layout/content_main中設置片段?在你的MapView

app:layout_behavior="@string/appbar_scrolling_view_behavior" 

+0

ü可以上傳完整佈局文件 –

+0

什麼是你的文件的'根佈局'? –

回答

1

你正在使用CoordinatorLayout這樣的MapView將AppbarLayout下顯示,你可以用AppbarLayout和MapView的到的LinearLayout或只是把

<fragment 
    android:layout_width="match_parent" 
    android:layout_height="45dp" 
    android:id="@+id/map" 
    tools:context="com.example.app.MapLocationActivity" 
    android:name="com.google.android.gms.maps.SupportMapFragment" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 
+0

完美的解決方案。謝謝! –