2016-11-24 4 views
1

Ich habe nächste Layout:Meine Symbolleiste Overlay meine Karte

<?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" /> 

Wenn ich meine Google Map erstellen aussehen Symbolleiste über Karte und oberen Bereich verbergen. Aber ich möchte die Karte im sichtbaren Bereich anzeigen. Wie setze ich ein Fragment in meinem @ layout/content_main?

+0

u komplette Layout veröffentlichen können Datei –

+0

Was ist das 'root-Layout' Ihrer Datei? –

Antwort

1

Sie benutzen CoordinatorLayout so MapView wird unter AppbarLayout angezeigt werden, können Sie AppbarLayout und MapView in Linearlayout wickeln oder einfach ausgedrückt:

app:layout_behavior="@string/appbar_scrolling_view_behavior" 

in Ihrem MapView:

<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

Perfekte Lösung. Vielen Dank! –

Verwandte Themen