0

I have a fragment with multiple linear layouts and one edit text box. However the keyboard stays open all the time. I've tried setting the fragment main layout as clickable and focusableInTouchMode which works but only for parts of the view that show the main layout. Any other parts of the view that are touched still do not hide the keyboard. Does anyone know how I can overcome this without adding focus listeners to all parts of the layout?

Amos Fox
  • 188
  • 10
  • Soft-keyboard does not hide automatically when you touch other views(like in iOS), you have to do it manually if you need. You can try setting |android:descendantFocusability="beforeDescendants"| on root or container views. To hide, follow this: https://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard You will probably come up with a solution. – Vikas Borkar Jan 29 '19 at 08:40

1 Answers1

0

Have you tried to set:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Bruno Diego Martins
  • 1,048
  • 1
  • 8
  • 27