[英]android google maps camera update,zoom
嗨,我的Google地圖相機和變焦出現問題。 基本上,我有一堂課,那里有標記和信息窗口以及地圖本身。 在另一個活動中,我有另一個班級和一個查看地圖的選項,但是當我單擊“查看地圖”選項的相機時,縮放不會更新並在我設置了該位置的位置上縮放地圖。 有什么建議嗎? 謝謝。
這是我的代碼,在其中我設置了地圖類,以便在選擇該選項時運行該地圖類,以及更新相機並將其縮放到特定位置。 我需要更新相機,並在選擇該選項時將其縮放到LOCATION_bar,但是發生的是,僅在打開地圖時沒有縮放或聚焦location_bar。
public class barzoomin extends Activity {
GoogleMap gMap;
private final LatLng LOCATION_bar=new LatLng(x , y);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intentvbar = new Intent(getApplicationContext(), THEMAP.class);
startActivity(intentbar);
gMap=((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
gMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_bar,18);
gMap.animateCamera(update);
}
}
嘗試使用另一個API密鑰。 我有同樣的問題,它解決了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.