2

I have ExpandableRecyclerView with EditTexts. On EditText I set input method number. And when I click on the EditText, everything is okay. But when I scroll my RecyclerView keyboard changes to standard. Does anyone have any idea how to fix this? Thank you in advance!

user6075877
  • 157
  • 2
  • 10

1 Answers1

0

Probably not the perfect solution, but here are a few steps to achieve this:

  • Prevent your RecyclerView from receiving focus. I had to do this from code for the reasons explained in this answer. This will hide your keyboard once you scroll your RecyclerView and your EditText gets out of view instead of changing it to standard
  • Then use a listener to detect when the keyboard is open/closed and when it gets opened use the lines below to prevent the keyboard from closing until the user specifically does so:

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0)
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
    
vicch
  • 564
  • 3
  • 10
  • 25