- 我谷歌了两天,仍然是这条消息。我使用调试密钥在我的 nexus 7 上进行调试。
- 我不知道哪里错了。我有右键,打开正确的 api 访问
- 但我平板电脑上的谷歌地图仍然空白。
地图片段:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
捆绑 savedInstanceState) {
查看 rootView = inflater.inflate(R.layout.map_fragment,container, false); 容器.removeAllViews(); 地图 = ((SupportMapFragment)getActivity() .getSupportFragmentManager() .findFragmentById(R.id.map)) .getMap(); map.setMyLocationEnabled(true); map.setMapType(GoogleMap.MAP_TYPE_NORMAL);mMapFragment = SupportMapFragment.newInstance(); FragmentTransaction fragmentTransaction =
getChildFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map,mMapFragment);
fragmentTransaction.commit(); 返回根视图;}
显现:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" /> <!-- Google Map --> <permission android:name="com.jertt.xxx.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.jertt.yummymap.permission.MAPS_RECEIVE"/>
<!-- end --> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <!-- end --> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.jertt.yummymap.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Google Map API Key --> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyB54eZnUp8Sw*****" /> <!-- end --> </application>
map_fragment.xml
<fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" />