2012-09-06 54 views
4

有人能告诉我如何在“Multiline”MultiAutoCompleteTextView上显示建议。我去了API参考Here如何在“多行”MultiAutoCompleteTextView上显示建议?

我试过这个例子,自动完成工作得很好,除了当我去下一行时,我没有看到任何更多的建议。

我有definees我MultiAutoCompleteTextView像这样的XML:

<?xml version="1.0" encoding="utf-8"?> 
<MultiAutoCompleteTextView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/html" 
     android:focusable="true" 
     android:gravity="top" 
     android:background="@null" 
     android:paddingLeft="5dp" 
     android:paddingRight="5dp" 
     android:paddingBottom="5dp" 
     android:singleLine="false" 
     android:completionThreshold="1" 
     android:textSize="14dp" 
     android:scrollHorizontally="true" 
     android:focusableInTouchMode="true" /> 

我的代码,不会的建议是,像这样:(从参考明白了)

MultiAutoCompleteTextView editor = (MultiAutoCompleteTextView) LayoutInflater.from(getApplicationContext()).inflate(R.layout.editor, null); 

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

因为我设置singleLine在我的MultiAutoCompleteTextView xml上为false。当我按Enter进入下一行时,建议不会显示。

任何人都可以帮助我解决这个问题。有没有办法我可以覆盖建议面板,以我的喜好?还有一种方法来定位面板? “

回答