开发者

How do you set the initial viewing position of a webview?

开发者 https://www.devze.com 2023-02-04 11:13 出处:网络
In android, I am loading a large United States map from the web inside a webview. The map is very large and what I would like to do is have the page pre-centered and possibly even pre-zoomed in on a

In android, I am loading a large United States map from the web inside a webview.

The map is very large and what I would like to do is have the page pre-centered and possibly even pre-zoomed in on a certain part of the map.

For example, in an earlier part of my ap开发者_StackOverflow中文版p the user types in a zip code. I would like the webview to be autofocused on that area of the map.

Please don't suggest using google maps!


Afaik you want your map to be centered in pointed place. WebView exposes few methods which allow you to get current scale, zoom in/out and scroll. So you have to do some math and use them to scroll and zoom to certain part.

0

精彩评论

暂无评论...
验证码 换一张
取 消