2015-10-02 2 views
0

Je veux implémenter une mise en page qui a un MapView et NavigationView, ci-dessous est ce que j'ai essayé suivant this tutoriel. Je reçois cette erreur android.view.InflateException: Binary XML file line #43: Error inflating class fragmen Quel est le problème?android.view.InflateException, Erreur gonflement classe de fragment

<android.support.v4.widget.DrawerLayout 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" 
    tools:context=".ShopsCatalogActivityUsingMapView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/drawer" 
    android:fitsSystemWindows="true"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <!--toolbar--> 
     <include 
      android:id="@+id/tool_bar" 
      layout="@layout/tool_bar"> 

     </include> 

     <!--map--> 
     <FrameLayout 
      android:id="@+id/frame" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 
      <!--map--> 
      <fragment xmlns:map="http://schemas.android.com/apk/res-auto" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:id="@+id/map" 
       android:name="com.google.android.gms.maps.SupportMapFragment" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       tools:context=".CustomInfo" /> 
     </FrameLayout> 
    </LinearLayout> 

    <!--navigation drawer--> 
    <android.support.design.widget.NavigationView 
     android:id="@+id/my_navigation_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     app:headerLayout="@layout/navigation_view_header" 
     app:menu="@menu/navigation_drawer_menu" /> 

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

ligne n ° 43 est celui qui a le fragment contenant la carte

+1

Est-ce votre fichier XML complet? ceux-ci doivent être enveloppés dans une disposition de tiroir –

+1

Affichez le fichier de mise en page entier, quelle ligne est # 43? – RobVoisey

Répondre

0

Dans <fragment

changement

android:name="com.google.android.gms.maps.SupportMapFragment" 

à

class = "com.google.android.gms.maps.SupportMapFragment"

Espérons que cela aide!

+0

toujours la même erreur –

+0

Ok, vérifiez si vous étendez le fragment comme ceci: import android.support.v4.app.Fragment; – Lazai

0

Le problème est que j'ai oublié d'ajouter la clé de l'API Google Maps au fichier manifeste. J'ai ajouté:

<meta-data 
     android:name="com.google.android.geo.API_KEY" 
     android:value="@string/google_maps_key" />