如何实现 google places 自动完成搜索框而不使用 places SDK for android?
how to implement google places autocomplete search box without places SDK for android?
我正在开发一个 android 应用程序,它使用 Uber 就像 google 使用 kotlin 的地图位置选择器。我已经实现了所有必需的功能,但无法找到有关实现位置搜索自动完成 EditTextView 的更新教程。
我想使用 google android 的 Places SDK 来实现搜索功能,该功能似乎已贬值并于 2019 年 7 月关闭(如此处所述:Places SDK for android).
如果有人可以帮助我在 android 应用程序中创建一个 EditText,当用户键入地点时它会根据搜索词建议地点。
仅 Place Picker widget is deprecated, not Autocomplete. You can use Place Autocomplete, either as a widget which gives you a pre-built search bar or programmatically to build a custom search UI. For the best user experience, define how you want to constrain results 基于位置 and/or 类型的地点,具体取决于您的用例。
full Autocomplete implementation 的示例代码在 Github,但目前仅在 Java。
作为 Google 自动完成功能的替代方案,可以选择 Places Search API 请求针对基本文本搜索基本字段。与自动完成功能相比,这将花费更少。基本字段包括formatted_address、geometry、icon、name、permanently_closed、photos、place_id、plus_code、types等对于某人的情况来说已经足够了。
你可以比较成本here。
因此您可以使用一些去抖动和机制来构建您自己的搜索UI。
我正在开发一个 android 应用程序,它使用 Uber 就像 google 使用 kotlin 的地图位置选择器。我已经实现了所有必需的功能,但无法找到有关实现位置搜索自动完成 EditTextView 的更新教程。
我想使用 google android 的 Places SDK 来实现搜索功能,该功能似乎已贬值并于 2019 年 7 月关闭(如此处所述:Places SDK for android).
如果有人可以帮助我在 android 应用程序中创建一个 EditText,当用户键入地点时它会根据搜索词建议地点。
仅 Place Picker widget is deprecated, not Autocomplete. You can use Place Autocomplete, either as a widget which gives you a pre-built search bar or programmatically to build a custom search UI. For the best user experience, define how you want to constrain results 基于位置 and/or 类型的地点,具体取决于您的用例。
full Autocomplete implementation 的示例代码在 Github,但目前仅在 Java。
作为 Google 自动完成功能的替代方案,可以选择 Places Search API 请求针对基本文本搜索基本字段。与自动完成功能相比,这将花费更少。基本字段包括formatted_address、geometry、icon、name、permanently_closed、photos、place_id、plus_code、types等对于某人的情况来说已经足够了。
你可以比较成本here。
因此您可以使用一些去抖动和机制来构建您自己的搜索UI。