小编Kas*_*chi的帖子

Android Fragment谷歌地图V2:错误膨胀类

我正在开发一个使用片段标签的应用程序,我的一个片段使用Google Maps V2" SupportMapFragment"

public class A extends Fragment {
   @Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) 
   {
    View view = null;
    view = inflater.inflate(R.layout.all_coffee_shops_view, container, false);
    map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();
   }
}
Run Code Online (Sandbox Code Playgroud)

我的xml:

<RelativeLayout
   android:id="@+id/map_container"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent">

   <fragment
     android:id="@+id/map"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     class="com.google.android.gms.maps.SupportMapFragment" 
   />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我从这个A片段(A-> B)调用B Fragment,当我从B->返回时,一个片段onCreateView抛出一个异常,"android.view.InflateException:二进制XML文件行#132:错误膨胀类片段"

android android-fragments

0
推荐指数
1
解决办法
2769
查看次数

标签 统计

android ×1

android-fragments ×1