如果我启动此应用程序,我可以正确地看到webview,但它不会加载谷歌地图(

https://maps.google.com/maps?q=43.0054446,-87.9678884&t=m&z=7),但它会加载正常的谷歌页面(

https://www.google.it/#q=43.0054446%2C-87.9678884).为什么?有办法解决吗?

public class MainActivity extends Activity

{

WebView myWebView;

String mapPath = "https://maps.google.com/maps";

@Override

protected void onCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

myWebView = (WebView)findViewById(R.id.mapview);

String map2="?q=43.0054446,-87.9678884&t=m&z=7";

myWebView.loadUrl(mapPath+map2);

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main, menu);

return true;

}

}

现在我有另一个问题.这是我的xml布局.

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

tools:context=".MainActivity" >

android:layout_width="wrap_content"

android:layout_height="wrap_content">

android:id="@+id/textview"

android:layout_height="@string/hello_world"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content">

android:id="@+id/mapview"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

我想在屏幕的上半部分显示WebView,但是当加载链接时,页面是全屏的(即使我在webview下插入了其他内容).为什么?

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐