使用multiautocompletetextview时,在完成按钮时隐藏键盘

时间:2013-11-05 14:40:52

标签: android

我有一个multiautocompletetextview

<MultiAutoCompleteTextView 
            android:id="@+id/email_editText_auto"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:hint="@string/enter_email_address_hint"
            android:inputType="textEmailAddress" 
           />

当我按下完成按钮时,似乎没有任何事情发生。当我按下完成按钮时,如何隐藏键盘?或者我在这里遗漏了什么?

2 个答案:

答案 0 :(得分:9)

这是一个愚蠢的错误,只需使用android:imeOptions="actionDone"

答案 1 :(得分:0)

这应该有效:

InputMethodManager inputManager = 
        (InputMethodManager) context.
            getSystemService(Context.INPUT_METHOD_SERVICE); 
inputManager.hideSoftInputFromWindow(
        this.getCurrentFocus().getWindowToken(),
        InputMethodManager.HIDE_NOT_ALWAYS); 
相关问题