如何在android中的webview中显示原生谷歌地图?

cap*_*oid 5 android google-maps android-webview

我有以下代码来显示webview:

webview.xml

<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
Run Code Online (Sandbox Code Playgroud)

WebViewActivity.java

public class WebViewActivity extends Activity {

    private WebView webView;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);

        webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("http://maps.google.com/maps?" +"saddr=43.0054446,-87.9678884" + "&daddr=42.9257104,-88.0508355");
    }
}
Run Code Online (Sandbox Code Playgroud)

我想在WebView中打开以下代码:

final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?" + "saddr=43.0054446,-87.9678884" + "&daddr=42.9257104,-88.0508355"));
intent.setClassName("com.google.android.apps.maps",
"com.google.android.maps.MapsActivity");
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点 ???

Aru*_*ole 2

请检查。它不会在 WebView 中打开本机 Google 地图应用程序,而是在 WebView 中加载http://maps.google.com/maps?~~

可能有帮助。