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

前端 未结 2 1218
慢半拍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 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.

提交回复
热议问题