Can anyone help me, Im beginner in android development, EditText is always focused, and i want to remove focus when clicking any other object, for example, ListView, Button... i want EditText to focus only when user clicks onto it
Asked
Active
Viewed 1,245 times
3 Answers
1
No object is focused by default so check your XML layout file and ensure you do not have <requestFocus />
set on EditText
in subject. If so, remove it from XML file - you may also want to check for requestFocus()
calls, just in case.

Marcin Orlowski
- 72,056
- 11
- 123
- 141
0
You can try using clearFocus() method on EditText..
EditText txt;
txt=(EditText) findViewById(R.id.somename);
txt.clearFocus();
Or you can use
private void hideDefaultKeyboard() {
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);//u have got lot of methods here
}

inquisitive
- 3,738
- 6
- 30
- 56
0
make sure there is no request focus in your layout and adding this might help
android:focusable="false" android:clickable="false"

vera
- 3
- 3