android.view.InflateException,膨胀片段类时出错
我想实现一个包含MapView和NavigationView的布局,下面是我在教程中尝试的内容。我收到这个错误android.view.InflateException,膨胀片段类时出错,android,android-fragments,fragment,android-inflate,Android,Android Fragments,Fragment,Android Inflate,我想实现一个包含MapView和NavigationView的布局,下面是我在教程中尝试的内容。我收到这个错误android.view.InflateException:Binary-XML文件行#43:error-inflaging-class-fragmen怎么了 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns
android.view.InflateException:Binary-XML文件行#43:error-inflaging-class-fragmen
怎么了
<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>
第43行是在
中包含映射的片段的那一行。问题是我忘了将google maps API键添加到清单文件中。我补充说:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
这是您的整个XML文件吗?这些需要包装在抽屉布局中发布整个布局文件,哪一行是#43?好的,检查是否像这样扩展片段:import android.support.v4.app.fragment;
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />