2016-03-30 19 views
1

Ich habe Probleme, eine Symbolleiste über die Google-Karte zu setzen.Symbolleiste über Google-Karte anzeigen

Ich folgte einer Online-Anzeige, aber wenn ich den Code starte, kann ich die Symbolleiste nicht sehen.

<FrameLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="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:orientation="vertical"> 

<android.support.v7.widget.Toolbar 
    xmlns:sothree="http://schemas.android.com/apk/res-auto" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/app_bar" 
    android:layout="@layout/toolbar" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent"/> 

<fragment 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/map" 
    android:layout_below="@+id/app_bar" 
android:name="com.google.android.gms.maps.SupportMapFragment" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.namexxx.app.homemap" 
/> 

</FrameLayout> 
+4

Ok, zuerst verwenden Sie ein framelayout und dann das Fragment: android: layout_below = "@ + id/app_bar" Verwenden Sie ein relatives Layout anstelle von FrameLayout. Außerdem können Sie die Höhe der Symbolleiste wie folgt ändern: android: layout_height = "wrap_content" android: minHeight = "? Attr/actionBarSize" – JpCrow

Antwort

2

korrigierte ich den Code basierend auf JPCrow Eingänge:

<RelativeLayout 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:background="@color/SecondaryBackground" 
tools:context="com.example.filippo.xxx.MainActivity" 
> 


<include android:id="@+id/app_bar" layout="@layout/toolbar"/> 


<fragment 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/map" 
    android:layout_below="@+id/app_bar" 
android:name="com.google.android.gms.maps.SupportMapFragment" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.filippo.xxx.homemap" 
/> 

</RelativeLayout> 

Jetzt funktioniert es. Vielen Dank.

Verwandte Themen