AutoCompleteTextView doesn't show dropdown when I press space after typing a complete word

前端 未结 4 888
囚心锁ツ
囚心锁ツ 2020-12-17 16:04

My main activity code:

// here you put all your data.
String[] dataArray = { \"Amit sharma Kumar\", \"Hisham Kumar Munner\",
        \"Vineet John Chaturvedi         


        
4条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 16:20

    First of all, you don't need TextWatcher with AutoCompleteTextView because AutoCompleteTextView has its own method to watch text i.e. MyWatcher. You need to use :

    setThreshold(3);
    final String[] AndroidDesk= getResources().getStringArray(R.array.clothname_arrays);
    ArrayAdapter My_arr_adapter= new ArrayAdapter(getApplicationContext(),
                android.R.layout.simple_dropdown_item_1line,AndroidDesk);      
       cloths.setThreshold(1);
       cloths.setAdapter(My_arr_adapter);
       cloths.setOnItemClickListener(new OnItemClickListener() {
       public void onItemClick(AdapterView arg0, View arg1, int arg2,long arg3) {                               
       }
       });
    

提交回复
热议问题