如何在Android Google Place的自动完成活动中更改占位符文本? [英] How to change placeholder text in an autocomplete activity of android google place?

查看:67
本文介绍了如何在Android Google Place的自动完成活动中更改占位符文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用选项2:使用意图启动自动完成活动 a>

是否可以将搜索"占位符文本更改为输入您的城市"之类的内容.我找到了解决方案,但对于javascript,也应该支持android .

Is it possible to change the "search" place holder text to something such as "enter your city". I found a solution but for javascript, suppose support android as well.

似乎可以使用 ,但是我使用自己的EditText通过意图启动自动完成功能,因此它没有帮助.

It seems it could be done with a PlaceAutocompleteFragment, but I am using my own EditText to launch autocomplete by using an intent, so it is not helpful.

推荐答案

似乎无法通过自动完成活动甚至PlaceAutocompleteFragment更改占位符文本,因为它也在内部使用了自动完成活动.唯一的方法是使用对它具有完全控制权的AutoCompleteTextView. Google提供了完整的示例代码,这些代码也易于集成并提供良好的用户体验.

It seems there is no way to change placeholder text with either auto complete activity or even with PlaceAutocompleteFragment because it also use autocomplete activity inside. The only way is using AutoCompleteTextView that you have full control on it. Google provides full sample code that is also easy to integrate and provide good UX.

https://github.com/googlesamples/android-play -places/tree/master/PlaceCompleteAdapter

我在此处创建功能请求,希望将来会得到支持.

I create a feature request here, hopefully it will be supported in the future.

这篇关于如何在Android Google Place的自动完成活动中更改占位符文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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