Android 使用MapFragment,但第三方库需要SupportMapFragment

Android 使用MapFragment,但第三方库需要SupportMapFragment,android,android-fragments,Android,Android Fragments,我使用的库在内部使用android.support.v4.app.Fragment 在我的应用程序中,我使用普通片段(android.app.Fragment) 我还使用GoogleMapsV2,我在一个从wizardroid类继承的片段中检索它(它本身从android.support.v4.app.fragment继承) { @凌驾 CreateView上的公共视图(布局、充气机、视图组容器、捆绑包保存状态) { 视图v=充气机。充气(R.layout.create\u event\u map

我使用的库在内部使用android.support.v4.app.Fragment

在我的应用程序中,我使用普通片段(android.app.Fragment)

我还使用GoogleMapsV2,我在一个从wizardroid类继承的片段中检索它(它本身从android.support.v4.app.fragment继承)

{ @凌驾 CreateView上的公共视图(布局、充气机、视图组容器、捆绑包保存状态) { 视图v=充气机。充气(R.layout.create\u event\u map,container,false)

}

如您所见,我将其转换为com.google.android.gms.maps.SupportMapFragment(),因为findFragmentById(R.id.map)返回一个support map片段。否则,我无法执行此操作,因为我将得到一个编译错误

这是映射片段所在的XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"
    />

在我的应用程序的其他地方,我都使用普通片段!

当我运行应用程序时,会出现以下异常: 11-08 20:47:19.178:E/AndroidRuntime(10347):android.view.InflateException:二进制XML文件行#8:膨胀类片段时出错

这是因为我在同一个应用程序中混合了片段和支持映射片段,还是因为我在做其他愚蠢的事情


如果答案是第一个,那么解决方案是更改wizardroid库的代码吗(我不需要对<4版本的支持)?

请注意,支持v4不仅仅包含API的替代品
    final Event event = ((EventInfo)getActivity()).getEvent();

    final GoogleMap googleMap = ((com.google.android.gms.maps.SupportMapFragment)getActivity().getFragmentManager().findFragmentById(R.id.map)).getMap();


    return v;
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"
    />