4

nachdem ich Schublade Menü und schwebende Taste warum meine Karten können nicht bekommen, meine Position und Standort Schaltfläche nicht anzeigen, und warum die Schaltfläche Suche, wenn es geklickt hat, so dass Kraft zu stoppen ? bevor ich Schublade Menü und Floating-Taste hinzufügen, es ist alles in Ordnung ..
Vor [pict]BEFORE
Nach [pict]AFTERkann nicht meinen Standort und Standort Schaltfläche nicht angezeigt

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context="com.emergency.MainActivity" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/drawerLayout"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
     <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:fitsSystemWindows="true"> 
      <android.support.v7.widget.Toolbar 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:id="@+id/toolbar"> 
      </android.support.v7.widget.Toolbar> 
     </android.support.design.widget.AppBarLayout> 
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:fab="http://schemas.android.com/apk/res-auto" 
      android:background="@color/background" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

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

      <com.getbase.floatingactionbutton.FloatingActionsMenu 
       android:id="@+id/multiple_actions" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentEnd="true" 
       fab:fab_addButtonColorNormal="@color/white" 
       fab:fab_addButtonColorPressed="@color/white_pressed" 
       fab:fab_addButtonPlusIconColor="@color/half_black" 
       fab:fab_labelStyle="@style/menu_labels_style" 
       android:layout_marginBottom="50dp" 
       android:layout_marginRight="16dp" 
       android:layout_marginEnd="16dp"> 

       <com.getbase.floatingactionbutton.FloatingActionButton 
        android:id="@+id/action_a" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        fab:fab_colorNormal="@color/white" 
        fab:fab_title="Tambal Ban" 
        fab:fab_colorPressed="@color/white_pressed" 
        fab:fab_size="mini"/> 
       <com.getbase.floatingactionbutton.FloatingActionButton 
        android:id="@+id/action_b" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        fab:fab_colorNormal="@color/white" 
        fab:fab_title="ATM" 
        fab:fab_colorPressed="@color/white_pressed" 
        fab:fab_size="mini"/> 
       <com.getbase.floatingactionbutton.FloatingActionButton 
        android:id="@+id/action_c" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        fab:fab_colorNormal="@color/white" 
        fab:fab_title="WC Umum" 
        fab:fab_colorPressed="@color/white_pressed" 
        fab:fab_size="mini"/> 

      </com.getbase.floatingactionbutton.FloatingActionsMenu> 

     </RelativeLayout> 
    </LinearLayout> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/navigationView" 
     android:layout_width="280dp" 
     android:layout_height="match_parent" 
     app:headerLayout="@layout/header_menu" 
     app:menu="@menu/menu_navigasi" 
     android:layout_gravity="start"> 
     <!--perintah buat nampilin menu utama kemudian bisa di slide yang ada menu adalah yang layout_gravity--> 


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

activity_maps.xml

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

    <LinearLayout 
     android:id="@+id/header_tempat" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <fragment 
     android:id="@+id/map" 
     android:name="com.google.android.gms.maps.SupportMapFragment" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     tools:context="com.emergency.MapsActivity" /> 
    </LinearLayout> 
    <Button 
     android:id="@+id/Bsearch" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="#ff4081" 
     android:src="@android:drawable/ic_dialog_map" 
     android:text="Search Place" 
     android:textColor="#fff" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:onClick="onSearch" 
     /> 

</RelativeLayout> 
+0

Setzen Sie Ihr Fehlerprotokoll bitte –

+0

hey, das ist mein logcat http://pastebin.com/BhE3VAnF leider unter Verwendung externen Link, weil, wenn ich in der Post schreiben es wird begrenzt sein. –

+0

Direkt von Ihrem Logcat: ** Mögliche Ursachen sind das google-services.json oder com.google.gms.google-services gradle plugin. **. Hast du diese zwei? – Vucko

Antwort

1

Für irgendein Grund SupportMapFragment zeigt meine loca nicht tion-Taste (oder Kompass-Symbol), wenn innerhalb <DrawerLayout> platziert seines (< - als Stammansicht), aber es gibt eine Lösung:

Das Ganze wird <DrawerLayout> in <RelativeLayout> und <include> entfernen und nur ganze activity_maps.xml in activity_main setzen. Auch, um es besser aussehen würde ich empfehlen activity_maps.xml bewegen und ein Fragment daraus zu machen, und dann statt <include> würden Sie haben:

<fragment 
    android:id="@+id/map_fragment" 
    class="com.yourpackage.MapFragment" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

Sie Logik nur im Fragment für Karte getrennt haben werden, eine alle Aktivitäten Sachen in Aktivität. Und wir alle wissen, dass MainActivity neigen aus vielen Gründen im Laufe der Zeit zu wachsen;)

Verwandte Themen