AutoCompleteTextView没有完成我

时间:2018-01-16 14:19:32

标签: java android xml

没有错误!
只有这个功能应该给我带来结果,但它没有显示任何内容 只是从字符串搜索中写出一个单词,没有任何结果 什么缺失?
在工具中添加更多代码?
字符串列表(来自firebase)显示在屏幕BTW

public void autoSearch(View view) {
    //auto search complete for comunity list
    this.context = context;
    String array1[] = firebaseComunityListArr.toArray(new String[firebaseComunityListArr.size()]);
                    AutoCompleteTextView txt = (AutoCompleteTextView) view.findViewById(R.id.myAutoComplete);
                    txt.addTextChangedListener(this);
                    txt.setAdapter(new ArrayAdapter<String>(getContext(), android.R.layout.simple_dropdown_item_1line, array1));
                    txt.setTextColor(Color.GREEN);
                    txt.setAdapter(adapter);
}

@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {           
}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {            
}

@Override
public void afterTextChanged(Editable editable) {            
}

的xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <AutoCompleteTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textAutoComplete|textAutoCorrect"
        android:imeOptions="actionSearch"
        android:hint="search here"
        android:id="@+id/myAutoComplete"/>

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/my_recycler_view"
        android:layout_below="@+id/myAutoComplete"/>



</RelativeLayout >

0 个答案:

没有答案