Android: Remove Enter Key from softkeyboard Android: Remove Enter Key from softkeyboard android android

Android: Remove Enter Key from softkeyboard


Use :android:singleLine = "true"or edittext.setSingleLine();

And your ENTER key is gone


add this tag to textView in xml

    android:singleLine = "true"


I am afraid you can't do this. But one thing is you can handle the softkeyboard keyevents like this,

edittext.setOnKeyListener(new OnKeyListener() {        public boolean onKey(View v, int keyCode, KeyEvent event) {                if (event.getAction() == KeyEvent.ACTION_DOWN                        && event.getKeyCode() ==       KeyEvent.KEYCODE_ENTER) {                    Log.i("event", "captured");                    return false;                }                 else if(event.getAction() == KeyEvent.ACTION_DOWN                        && event.getKeyCode() == KeyEvent.KEYCODE_BACK){                    Log.i("Back event Trigered","Back event");                }            }            }            return false;        }    });

Apart from this, you have to note that providing the attribute android:singleLine=true will make your edittext from growing in size when the soft keyborad ENTER is pressed