現在、私は自分のプロジェクトでGoogleマップに取り組んでいます。 私は以下のAPIバージョンとGoogleマップのディスプレイを使用しています。Googleマップのズーム機能が動作しません
android.gms:play-services-maps:9.0.2
android.gms:play-services-location:9.0.2
問題:
私はタッチでマップをズームしようとすると、グーグルマップがズームしないと 私も別の場所を見るためにマップを移動することができませんでしだ。
は、ここに私のコードです:
@Override
public void onMapReady(GoogleMap googleMap) {
//googleMap.getUiSettings().setZoomControlsEnabled(true);
mMap = googleMap;
Log.i(TAG, "onMapReady");
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this,"Please enable GPS location on your phone",Toast.LENGTH_SHORT).show();
return;
}
Log.i(TAG, "my location enabled");
mMap.setMyLocationEnabled(true);
map.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);
buildGoogleApiClient();
if (mMap == null) {
return;
}
/* currentLatLng= new LatLng (currentLocationLatitude,currentLocationLongitude);
Log.i(TAG,"inside onMapready --->");*/
}
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
mGoogleApiClient.connect();
}
* XMLファイルが含まれている* これは私がGoogleマップを表示するために使用していたXMLレイアウトファイルです。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
xmlns:app="http://schemas.android.com/apk/res-auto">
<fragment android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mega.hertz.seeky.MainActivity"/>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="vertical"
android:paddingBottom="@dimen/vertical_page_margin"
android:paddingLeft="@dimen/horizontal_page_margin"
android:paddingRight="@dimen/horizontal_page_margin"
android:paddingTop="@dimen/margin_small">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="50dp">
<fragment
android:id="@+id/autocomplete_fragment"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
がhiそこに、私はxmlファイル –
あなたのXMLファイルを共有します私はそれが動作していないとまた、私はマップを基本的に移動することはできませんマップ上の指のタッチは動作していません – user1439582