当' @'生成ListView时被检测到

时间:2015-08-30 08:46:10

标签: android listview android-listview android-edittext

令人惊讶的是,我无法找到关于这个主题的任何内容。当' @'是什么时候生成ListView的方法是什么?在EditText中检测到。这是一个例子:

enter image description here

这是我到目前为止所做的:

 textfield.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    String newtext= textfield.getText().toString();
                    if(newtext.equals("@"))
                    {
                         //ListView with people need to appear
                    }
                    return false;
                }
            });

我知道如何编写适配器代码,我需要动态显示ListView。

1 个答案:

答案 0 :(得分:1)

这可能是AutoCompleteTextViewMultiAutoCompleteTextView

如果不是固定列表而是从Web或数据库中查找此列表(例如),我认为您需要提供一个指定过滤器的自定义适配器。见https://stackoverflow.com/a/8784931/360211