2016-11-24 8 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" /> 

私はツールバーがマップ上にあり、トップエリアを隠すように私のGoogleマップを見て作成します。しかし、私は目に見えるエリアに地図を表示したい。私の@ layout/content_mainにフラグメントを設定するには?

+0

uは完全なレイアウトを投稿することができますファイル –

+0

ファイルのルートレイアウトは何ですか? –

答えて

1

のMapViewは、あなたがのLinearLayoutにAppbarLayoutとのMapViewを包むか、単に置くことができ、AppbarLayoutの下に表示されますので、あなたがCoordinatorLayoutを使用している:あなたのMapViewで

app:layout_behavior="@string/appbar_scrolling_view_behavior" 

<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

完璧なソリューション。ありがとうございました! –

関連する問題