Google Place自动完成功能的初始位置 [英] Initial place for google place autocomplete

查看:59
本文介绍了Google Place自动完成功能的初始位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了Google Map Place自动完成API.现在,在初始加载时,我想在自动完成输入中显示一个位置.没有设置文本框的值,有什么办法可以实现?

I am using google map place autocomplete API in my application. Now at the initial load i want to show one location on that input of autocomplete. Is there any way i can achieve it without setting value of the text box ?

推荐答案

该API可能不支持这样的功能.但是,您可以通过在文本框中预填所需的位置,然后将地图放在该位置的中心来模拟相同的情况.

Probably the API doesn't support anything like that. However, you can simulate the same by prefilling the text box with the location you want and then center your map on that location.

例如:您可以在文本框中预填班加罗尔,卡纳塔克邦",然后将地图居中于12.970786、77.593466(班加罗尔的拉特和朗格).

For example: You can prefill the textbox with 'Bangalore, Karnataka' and center the map at 12.970786, 77.593466 (Lat and Lng of Bangalore).

这篇关于Google Place自动完成功能的初始位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆