简体   繁体   English

如何在android应用程序中实现自己的提示

[英]How to implement your own hints in android application

I have prepared list with about 200 words for my application.我为我的申请准备了大约 200 字的清单。 There are only names of mountain peaks (Polish) like Rysy, Giewont, Ornak, etc.只有 Rysy、Giewont、Ornak 等山峰的名称(波兰语)。

I would like to get this names as hints while user is writing a name of a peak.我想在用户编写峰名称时将此名称作为提示。

For example - after running my app, user wants to find a Giewont but he doesn't know how to write it, when he apply G, there are suggestions for him "Giewont", "Grzes" and more.例如 - 运行我的应用程序后,用户想找到一个 Giewont 但他不知道如何编写它,当他应用 G 时,有给他的建议“Giewont”、“Grzes”等等。 If he apply Gi, then second hint - "Grzes" is not seen anymore.如果他应用 Gi,那么第二个提示 - “Grzes”将不再可见。

Is there a possibility to implement something like this dynamically?有没有可能动态地实现这样的东西?

Also is there an option to remove "Android keyboard hints" in app or is this possible only in Android Phone?还有一个选项可以删除应用程序中的“Android 键盘提示”,还是只能在 Android 手机中删除?

You can do this with AutoCompleteTextView.您可以使用 AutoCompleteTextView 执行此操作。 AutoCompleteTextView receives an ArrayAdapter object for suggestions like this: AutoCompleteTextView 接收一个 ArrayAdapter 对象以提供如下建议:

val hints = {the name of peaks}
val adapter = ArrayAdapter<String> (context, android.R.layout.select_dialog_item, hints)
autoCompleteTextView.threshold(/* an integer for the threshold */ 1)
autoCompleteTextView.adapter(adapter)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM