我想在片段内的webview上加载我的android应用程序内的地图。我使用下面的代码

时间:2016-06-21 07:09:26

标签: android google-maps webview

3 个答案:

答案 0 :(得分:0)

这是因为Android会读取您的Intent并提供可以处理该Intent的应用程序列表。最佳解决方案是使用MapFragment显示地图

答案 1 :(得分:0)

尝试这样的事情

  webView.setWebViewClient(new WebViewClient());
        webView.getSettings().setJavaScriptEnabled(true);
//        webView.loadUrl("http://maps.google.com/maps?" + "saddr=43.0054446,-87.9678884" + "&daddr=42.9257104,-88.0508355");
        webView.loadUrl("https://www.google.com.au/maps/place/Hilton+Sydney/@-33.8719105,151.2058663,17z/data=!3m1!4b1!4m13!1m7!3m6!1s0x6b12ae3ef48720f1:0xe4cb86124df9b798!2sHilton+Sydney!3b1!8m2!3d-33.871915!4d151.208055!3m4!1s0x6b12ae3ef48720f1:0xe4cb86124df9b798!8m2!3d-33.871915!4d151.208055");

答案 2 :(得分:0)

尝试创建谷歌地图活动,并在地图视图中将您的位置的纬度和逻辑推移到它。

public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
  // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(yourlatitude, yourlongitude);
    mMap.addMarker(new MarkerOptions().position(sydney).title("Hilton Sydney"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}

希望这会有所帮助