首先在布局文件中的EditText添加android:imeOptions="actionSearch" android:inputType="text";
phoneEd.setOnEditorActionListener(new TextView.OnEditorActionListener(){
@Override
public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
if(arg1 == EditorInfo.IME_ACTION_SEARCH)
{
Toast.makeText(AddMemberActivity.this,"呵呵",Toast.LENGTH_SHORT).show();
// search pressed and perform your functionality.
}
return false;
}
});