0

我正在创建自己的键盘并使用 mMultiAuto.setText 将输入的每个字母放入 MultiAutoCompleteTextView。我已经按照所有教程进行了创建

mMultiAuto = (MultiAutoCompleteTextView)findViewById( R.id.multiautotextview );
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    mMultiAuto.setAdapter(adapter);  
    mMultiAuto.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

问题是当我在文本视图中输入一个字母时,下拉列表不显示。谁能帮忙?

4

1 回答 1

3

用以下代码替换您的代码

mMultiAuto = (MultiAutoCompleteTextView)findViewById( R.id.multiautotextview );
        adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
        mMultiAuto.setAdapter(adapter);  

                            mMultiAuto.setThreshold(1);

                            mMultiAuto.setAdapter(soAdapter);

                            mMultiAuto.setOnTouchListener(new View.OnTouchListener() {

                                @Override
                                public boolean onTouch(View v, MotionEvent event) 
                                {
                                    mMultiAuto.showDropDown();
                                    return false;
                                }
                            });
于 2013-08-23T07:21:48.147 回答