SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length error whenever an editText becomes empty

前端 未结 2 1217
慢半拍i
慢半拍i 2021-01-24 22:08

Test device: GSM galaxy nexus 4.2 (tested with both built in keyboard and swiftkey 3)

In my app I create a dialog to prompt the user for input. The dialog displays an Ed

相关标签:
2条回答
  • 2021-01-24 22:52

    Just add this property to your edittext and your problem will definitely be resolved

    android:inputType="textNoSuggestions"
    

    Add the above property to each of your edit text used in the application, or simply where you get the error in that edit text only.

    0 讨论(0)
  • 2021-01-24 23:03

    I've never seen that particular error before, but my guess is that its this line that causes it:

    dialog.getWindow().setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    

    That should open the soft keyboard even when the edit box isn't focused. So the input connection isn't correctly set up, leaving the keyboard with limited functionality. Setting the focus first might help it. So might using LayoutParams.SOFT_INPUT_STATE_VISIBLE without the always- it would prevent the keyboard from having a bad input connection due to not being tied to an editor.

    0 讨论(0)
提交回复
热议问题