android.view.InflateException:二进制XML文件行#94:膨胀类片段时出错
我有以下代码,我正在使用sherlockfragmentsandroid.view.InflateException:二进制XML文件行#94:膨胀类片段时出错,android,google-maps,android-fragments,Android,Google Maps,Android Fragments,我有以下代码,我正在使用sherlockfragments map = ((SupportMapFragment) getActivity().getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.c
map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="450px"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
map=((SupportMapFragment)getActivity().getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
我得到了一个错误:
android.view.InflateException:Binary XML文件行#94:错误膨胀类片段我不确定这是否是正确答案,但尝试将你的片段放在a中,可能会解决问题。我不确定这是否是正确答案,但尝试将你的片段放在a中,它可能会解决问题。尝试删除getActivity() 只需通过以下方式尝试更改:
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
它确实对我有用…希望它也对你有用尝试删除getActivity() 只需通过以下方式尝试更改:
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
它确实对我有用…希望它也对你有用
谢谢大家的建议
<Meta> Tag should be in <Application> Tag.
标记应位于标记中。
已解决
谢谢大家的建议
<Meta> Tag should be in <Application> Tag.
标记应位于标记中。
尝试使用以下方法:
private GoogleMap MAP;
FragmentManager myFM = getSupportFragmentManager();
SupportMapFragment myMAPF = (SupportMapFragment) myFM
.findFragmentById(R.id.map);
MAP = myMAPF.getMap();
此外,您还必须通过以下方式进行更改:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="450px"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
到
尝试使用以下方法:
private GoogleMap MAP;
FragmentManager myFM = getSupportFragmentManager();
SupportMapFragment myMAPF = (SupportMapFragment) myFM
.findFragmentById(R.id.map);
MAP = myMAPF.getMap();
此外,您还必须通过以下方式进行更改:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="450px"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
到
这是整个xml布局文件吗?如果没有,请发布完整的一个?这是整个xml布局文件吗?如果没有,请把完整的寄出去好吗?