如何在 onCreate() 中设置 MapView 缩放级别?
我正在开发一个 OneMap Android 应用程序,代码如下:
private MapView map;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = (MapView) findViewById(R.id.map);
map.addLayer(new ArcGISTiledMapServiceLayer(Practice_3.this,
"http://www.onemap.sg/ArcGIS/rest/services/BASEMAP/MapServer"));}
我不知道如何在模拟器上加载地图时首次加载地图时设置缩放级别,地图太小了。
有人能帮我解决这个问题吗?
任何帮助将不胜感激。
I'm developing a OneMap Android application and the code is as follows:
private MapView map;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = (MapView) findViewById(R.id.map);
map.addLayer(new ArcGISTiledMapServiceLayer(Practice_3.this,
"http://www.onemap.sg/ArcGIS/rest/services/BASEMAP/MapServer"));}
I'm lost at figuring out how to set the zoom level when the map is first loaded on the emulator as on load, the map is too small.
Could anyone help me with this?
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先你需要知道你当前的位置,现在你可以使用新的位置 API,这里是
但请记住 .connect() LocationClient 在 onCreate() 下。
如果您不遵循,您将收到以下错误消息
Android:位于 com.google.android.gms.internal .uy(来源不明)
Firstly you need to know your current location, now you can use new location api, here is the guide.
then you can add below command under
Onconnect()
but remember .connect() LocationClient under onCreate().
here is the error message you will get if you not follow
Android: at com.google.android.gms.internal.u.y(Unknown Source)
您似乎正在使用 ArcGIS 地图。
请使用以下示例代码在地图启动时设置缩放级别。
您还可以在活动文件中设置,
让我知道它是否适合您。
It looks like you`re using ArcGIS maps.
Please use the below sample code to set zoom level on the launch of the maps.
you can also set in activity file,
Let me know if it works for you.