Bonjour, je suis en train de mettre en œuvre Google Maps dans mon application Android et je réussi à le faire au moins partially.There sont beaucoup de bugs dans ma carte (il ne sera pas affiché jusqu'à ce que vous cliquez quelques fois sur l'écran, vous ne pouvez pas zoomer, vous ne pouvez pas déplacer uniquement appuyez sur l'écran et l'espoir que quelque chose va arriver) Voici mon code:cartes Google agissant bizarre dans mon application
public class LocatorFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
GoogleMap.OnInfoWindowClickListener,
GoogleMap.OnMapLongClickListener,
GoogleMap.OnMapClickListener,
GoogleMap.OnMarkerClickListener{
private MapView mapView;
private GoogleMap map;
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.locator_fragment, parent, false);
mapView=(MapView)rootView.findViewById(R.id.mapview);
mapView.onCreate(savedInstanceState);
// Gets to GoogleMap from the MapView and does initialization stuff
map = mapView.getMap();
// Defines the xml file for the fragment
return rootView;
}
// This event is triggered soon after onCreateView().
// Any view setup should occur here. E.g., view lookups and attaching view listeners.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
}
@Override
public void onConnected(@Nullable Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
@Override
public void onInfoWindowClick(Marker marker) {
}
@Override
public void onMapClick(LatLng latLng) {
}
@Override
public void onMapLongClick(LatLng latLng) {
}
@Override
public boolean onMarkerClick(Marker marker) {
return false;
}
}
Ceci est ma mise en page:
<com.google.android.gms.maps.MapView
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Donc quand j'ouvre un fragment de carte, j'obtiens une grille vide puis à chaque clic sur cette grille, il charge une partie de la carte: O c'est vraiment bizarre. Et je ne peux pas zoomer ou déplacer la carte
Pourquoi vous utilisez toujours 'getMap()'? C'est obsolète. Je suggère de passer en revue le Quickstart Android Maps pour vous familiariser avec la dernière mise en œuvre. –