SORU
28 Aralık 2012, Cuma


Google Maps v2 - hem benim konumunu ayarlamak ve yakınlaştırma

Benim sorum, herkes google maps kurmak, hem yerimi açmak ve görünümünde Yakınlaştırılmış için nasıl biliyor mu?

Şu anda ana ekranda Afrika, tüm yol uzaklaştırdınız açılır.

Ve bu yüzden günlerdir arıyordum, ve bulabildiğim tüm

1) google harita iki şey yakınlaştırmak ve bulunduğum yere gitmek gibi bir uygulama olamaz? Eğer animate kurdum önce zoom ayarlamak için nasıl anlamaya eğer, o zaman bu sorun çözülmüş olur. Bu sorunu olma eğilimindedir, bir değiştirebilirsiniz, ancak her iki eğilimindedir.

2) yararlı olabilecek diğer sınıfları buldum, ama sınıfın google haritası işlemek şifreyi ayarlama konusunda yardımcı yoktur.

Bu şimdiye kadar, bazıları çalışır, bazıları değil içimde tutuyordum kodudur. Düşündüm biraz daha sonra yararlı olabilir.

package com.MYWEBSITE.www;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

public class MainActivity extends FragmentActivity {
private GoogleMap map;  

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);

    map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    map.setMyLocationEnabled(true);

    //LocationSource a = (LocationSource) getSystemService(Context.LOCATION_SERVICE);
    //LocationManager b = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    //map.setLocationSource(a);

    Criteria criteria = new Criteria();
    LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    String provider = locationManager.getBestProvider(criteria, false);
    Location location = locationManager.getLastKnownLocation(provider);
    double lat =  location.getLatitude();
    double lng = location.getLongitude();
    LatLng coordinate = new LatLng(lat, lng);

    //CameraPosition.Builder x = CameraPosition.builder();
    //x.target(coordinate);
    //x.zoom(13);

    //Projection proj = map.getProjection();
    //Point focus = proj.toScreenLocation(coordinate);

    //map.animateCamera(CameraUpdateFactory.newLatLng(coordinate));
    map.animateCamera(CameraUpdateFactory.zoomBy(13));
    //map.moveCamera(CameraUpdateFactory.newLatLng(coordinate));


    ////LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds;
}
}

CEVAP
8 Ocak 2013, Salı


Olası yeri, büyütme, yatak ve tek seferde eğim değiştirmek için. Aynı zamanda animatecamera arama süresi ayarlamak için.

CameraPosition cameraPosition = new CameraPosition.Builder()
    .target(MOUNTAIN_VIEW)      // Sets the center of the map to Mountain View
    .zoom(17)                   // Sets the zoom
    .bearing(90)                // Sets the orientation of the camera to east
    .tilt(30)                   // Sets the tilt of the camera to 30 degrees
    .build();                   // Creates a CameraPosition from the builder
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

Doktorlar buraya bakın:

https://developers.google.com/maps/documentation/android/views?hl=fr-FR#moving_the_camera

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • LearnKey

    LearnKey

    19 AĞUSTOS 2008
  • STITCHLESS TV how to sew your own style tutorials

    STITCHLESS T

    9 HAZİRAN 2011
  • TastyTuts | Creative video tutorials by Gareth David

    TastyTuts |

    6 Temmuz 2011