public class OnEditActionListener implements OnEditorActionListener
{
@Override
public boolean onEditorAction(TextView v, int actionId, android.view.KeyEvent event) {
if(actionId ==EditorInfo.IME_ACTION_UNSPECIFIED){
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
ShipContentSearch(false);
}
return false;
};
{
@Override
public boolean onEditorAction(TextView v, int actionId, android.view.KeyEvent event) {
if(actionId ==EditorInfo.IME_ACTION_UNSPECIFIED){
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
ShipContentSearch(false);
}
return false;
};
}
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/home_edit_bg"
android:id="@+id/home_search"
android:paddingLeft="5dp"
android:layout_marginRight="50dp"
android:drawablePadding="5dp"
android:hint="点击查询配件"
android:textColor="@color/black"
android:imeOptions="actionSearch"
android:singleLine="true"
/>