使用存储 ID 的 MultiAutoCompleteTextview

Using MultiAutoCompleteTextview which stores ids

在我的应用程序中,我想使用 MultiAutoCompleteTextview 来获得类似 Facebook 提及的效果。在我输入“@”后,我想获得一个下拉列表,从中 select 一个人。这将在 MACTextView 中显示此人的姓名。

"Went to the cinema with John Doe"(What the user sees)-> "Went to the cinema with [person:245]"(What I need to store)

我怎样才能做到这一点?我知道如何查询我的数据库以及如何使用 MultiAutoCompleteTextview。我只是需要帮助来区分显示的内容和存储的内容。

我使用 Linkedin 的 spyglass library 解决了这个问题。这提供了一个非常可定制的提及编辑文本。它通过为提及设置跨度来工作。保存时,我使用了 getSpan() 并用我的标签替换了跨度。