大佬教程收集整理的这篇文章主要介绍了android – 谷歌键盘搞砸了我的自定义范围,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@R_352_10673@下事情:
在我的EditText中,我写了一些文字.
我选择它并使用SPAN_EXCLUSIVE_EXCLUSIVE(33)作为标志应用粗体.
好的,这是问题所在.我的大胆旗帜已经改变……为什么!?
这是一些日志:
D/ContentUtils: beforeTextChanged: start end span flags D/ContentUtils: beforeTextChanged: 0 7 ChangeWatcher 8388626 D/ContentUtils: beforeTextChanged: 0 7 ChangeWatcher 6553618 D/ContentUtils: beforeTextChanged: 0 7 TextKeyListener 18 D/ContentUtils: beforeTextChanged: 0 7 SpanController 18 D/ContentUtils: beforeTextChanged: 7 7 START 546 D/ContentUtils: beforeTextChanged: 7 7 END 34 D/ContentUtils: beforeTextChanged: 0 7 SpellcheckSpan 33 D/ContentUtils: beforeTextChanged: 0 7 CustomBoldSpan 33 D/ContentUtils: ontextChaghed D/ContentUtils: ontextChaghed: 0 8 ChangeWatcher 8392722 D/ContentUtils: ontextChaghed: 0 8 ChangeWatcher 6557714 D/ContentUtils: ontextChaghed: 0 8 TextKeyListener 4114 D/ContentUtils: ontextChaghed: 0 8 SpanController 4114 D/ContentUtils: ontextChaghed: 8 8 START 546 D/ContentUtils: ontextChaghed: 8 8 END 34 D/ContentUtils: ontextChaghed: 0 8 CustomBoldSpan 4129 D/ContentUtils: ontextChaghed: 0 8 Underlinespan 289 D/ContentUtils: ontextChaghed: 0 8 ComposingText 289 D/ContentUtils: afterTextChanged D/ContentUtils: afterTextChanged: 0 8 ChangeWatcher 8392722 D/ContentUtils: afterTextChanged: 0 8 ChangeWatcher 6557714 D/ContentUtils: afterTextChanged: 0 8 TextKeyListener 4114 D/ContentUtils: afterTextChanged: 0 8 SpanController 4114 D/ContentUtils: afterTextChanged: 8 8 START 546 D/ContentUtils: afterTextChanged: 8 8 END 34 D/ContentUtils: afterTextChanged: 0 8 CustomBoldSpan 4129 D/ContentUtils: afterTextChanged: 0 8 Underlinespan 289 D/ContentUtils: afterTextChanged: 0 8 ComposingText 289 D/ContentUtils: afterTextChanged: 0 8 SpellcheckSpan 33
当我使用另一个键盘时,一切都很好.
当我禁用文本修正设置时,一切都很顺利.
我的所有范围都是自定义范围,并且是现有Android范围的子类.
问题是针对每个打字的字母,该字词被删除并添加回添加的字母.在这一点上,我松开了一些自定义跨度,就像在单词中间那些.
如果你将TextWatcher添加到EditText,它将被调用2次:首先添加字母,第二次删除后添加回整个单词.根本不方便.
因此,一个丑陋的解决方案是在beforeTextChanged()期间复制所有跨度,并在第二个afterTextChanged()期间应用.但实施起来很复杂.
无论如何,其他应用程序没有做得更好:GMail和Evernote有同样的问题.我选择不担心,不应用丑陋的解决方案.我的富文本编辑器可以像这样使用……
以上是大佬教程为你收集整理的android – 谷歌键盘搞砸了我的自定义范围全部内容,希望文章能够帮你解决android – 谷歌键盘搞砸了我的自定义范围所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。